Class: Taskinator::TaskWorker
- Inherits:
-
Object
- Object
- Taskinator::TaskWorker
- Defined in:
- lib/taskinator/task_worker.rb
Instance Method Summary collapse
-
#initialize(uuid) ⇒ TaskWorker
constructor
A new instance of TaskWorker.
- #perform ⇒ Object
Constructor Details
#initialize(uuid) ⇒ TaskWorker
Returns a new instance of TaskWorker.
3 4 5 |
# File 'lib/taskinator/task_worker.rb', line 3 def initialize(uuid) @uuid = uuid end |
Instance Method Details
#perform ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/taskinator/task_worker.rb', line 7 def perform task = Taskinator::Task.fetch(@uuid) return if task.paused? || task.cancelled? begin task.start! task.complete! if task.can_complete? rescue Exception => e task.fail!(e) end end |