Module: Flydata::Helper::Worker
- Includes:
- FlydataCore::Logger
- Defined in:
- lib/flydata/helper/worker.rb
Instance Method Summary collapse
-
#after_start ⇒ Object
ServerEngine hook point.
- #initialize ⇒ Object
-
#reload ⇒ Object
ServerEngine hook point.
-
#run ⇒ Object
ServerEngine hook point.
-
#stop ⇒ Object
ServerEngine hook point.
Instance Method Details
#after_start ⇒ Object
ServerEngine hook point
41 42 43 |
# File 'lib/flydata/helper/worker.rb', line 41 def after_start log_debug("after_start") end |
#initialize ⇒ Object
9 10 11 12 |
# File 'lib/flydata/helper/worker.rb', line 9 def initialize @stop_flag = ServerEngine::BlockingFlag.new super end |
#reload ⇒ Object
ServerEngine hook point
34 35 36 37 38 |
# File 'lib/flydata/helper/worker.rb', line 34 def reload log_debug("reload") super self.stop end |
#run ⇒ Object
ServerEngine hook point
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/flydata/helper/worker.rb', line 15 def run add_log_context_items(object_id: self.object_id) log_debug("run") until @stop_flag.set? run_once end rescue => e log_error_with_backtrace("Unexpected error.", error: e) @stop_flag.wait_for_set(5.0) raise e end |
#stop ⇒ Object
ServerEngine hook point
28 29 30 31 |
# File 'lib/flydata/helper/worker.rb', line 28 def stop log_debug("stop") @stop_flag.set! end |