Class: SolidQueue::Semaphore
- Defined in:
- app/models/solid_queue/semaphore.rb
Defined Under Namespace
Classes: Proxy
Class Method Summary collapse
-
.create_unique_by(attributes) ⇒ Object
Requires a unique index on key.
- .signal(job) ⇒ Object
- .signal_all(jobs) ⇒ Object
- .wait(job) ⇒ Object
Methods inherited from Record
Class Method Details
.create_unique_by(attributes) ⇒ Object
Requires a unique index on key
22 23 24 25 26 27 28 29 30 |
# File 'app/models/solid_queue/semaphore.rb', line 22 def create_unique_by(attributes) if connection.supports_insert_conflict_target? insert({ **attributes }, unique_by: :key).any? else create!(**attributes) end rescue ActiveRecord::RecordNotUnique false end |
.signal(job) ⇒ Object
13 14 15 |
# File 'app/models/solid_queue/semaphore.rb', line 13 def signal(job) Proxy.new(job).signal end |
.signal_all(jobs) ⇒ Object
17 18 19 |
# File 'app/models/solid_queue/semaphore.rb', line 17 def signal_all(jobs) Proxy.signal_all(jobs) end |