Module: Ntswf::Worker
Constant Summary collapse
- RETRY =
reason value to force task reschedule, may be set if the worker is unable process the task
"Retry"
Instance Method Summary collapse
-
#in_subprocess(method) ⇒ Object
Run a method in a separate thread.
Methods included from Base
#activity_task_list, #activity_task_lists, #activity_type, #decision_task_list, #default_unit, #domain, #execution_version, #initialize, #notify, #parse_input, #separator, #swf, #workflow_name, #workflow_version
Instance Method Details
#in_subprocess(method) ⇒ Object
Run a method in a separate thread. This will ensure the call lives on if the master process is terminated. If the :subprocess_retries configuration is set StandardErrors during the method call will be retried accordingly.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ntswf/worker.rb', line 14 def in_subprocess(method) $stdout.sync = true if child = fork srand now = Time.now announce("#{method}: forked #{child} at #{now} (#{now.to_i})") Process.wait(child) else with_retry(@config.subprocess_retries || 0) { send method } exit! end end |