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 process.
Methods included from Base
#activity_task_list, #activity_task_lists, #activity_type, #configure, #decision_task_list, #default_unit, #domain, #execution_version, #notify, #on_notify, #parse_input, #separator, #swf, #workflow_name, #workflow_version
Instance Method Details
#in_subprocess(method) ⇒ Object
Run a method in a separate process. 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.
Exits the process if the :pidfile configuration is set and the PID file has been modified.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ntswf/worker.rb', line 16 def in_subprocess(method) raise_on_pidfile_change if @config.pidfile $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 |