Module: Izanami::Worker::InstanceMethods
- Defined in:
- lib/izanami/worker.rb
Instance Method Summary collapse
-
#call ⇒ Object
Main worker action.
-
#defer ⇒ String, Fixnum
Executes a #call method in a different process, forking the current one.
- #run ⇒ Object
Instance Method Details
#call ⇒ Object
Main worker action. Must be defined in the concrete class.
49 50 51 |
# File 'lib/izanami/worker.rb', line 49 def call raise 'The method #call should be defined in the worker class' end |
#defer ⇒ String, Fixnum
Note:
the process forked is detached.
Executes a #call method in a different process, forking the current one.
41 42 43 44 45 46 |
# File 'lib/izanami/worker.rb', line 41 def defer pid = Process.fork { call } Process.detach(pid) pid end |
#run ⇒ Object
54 55 56 |
# File 'lib/izanami/worker.rb', line 54 def run call end |