Class: LockTask
- Inherits:
-
Object
- Object
- LockTask
- Defined in:
- app/services/lock_task.rb
Instance Attribute Summary collapse
-
#execution_type ⇒ Object
readonly
Returns the value of attribute execution_type.
Instance Method Summary collapse
- #any_pending? ⇒ Boolean
-
#initialize(execution_type:) ⇒ LockTask
constructor
A new instance of LockTask.
- #perform ⇒ Object
Constructor Details
#initialize(execution_type:) ⇒ LockTask
Returns a new instance of LockTask.
6 7 8 |
# File 'app/services/lock_task.rb', line 6 def initialize(execution_type:) @execution_type = execution_type end |
Instance Attribute Details
#execution_type ⇒ Object (readonly)
Returns the value of attribute execution_type.
4 5 6 |
# File 'app/services/lock_task.rb', line 4 def execution_type @execution_type end |
Instance Method Details
#any_pending? ⇒ Boolean
26 27 28 |
# File 'app/services/lock_task.rb', line 26 def any_pending? all_pending.any? end |
#perform ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/lock_task.rb', line 10 def perform task = all_pending .find_one_and_update( { "$set" => { status: "starting" } }, return_document: :after ) return unless task task.reload persist_metrics(task) task end |