Class: Dynflow::Actor::PoliteTermination

Inherits:
Concurrent::Actor::Behaviour::Abstract
  • Object
show all
Defined in:
lib/dynflow/actor.rb

Overview

Behaviour that watches for polite asking for termination and calls corresponding method on the context to do so

Instance Method Summary collapse

Instance Method Details

#on_envelope(envelope) ⇒ Object



115
116
117
118
119
120
121
122
123
124
# File 'lib/dynflow/actor.rb', line 115

def on_envelope(envelope)
  message, terminated_future = envelope
  if :start_termination == message
    context.start_termination(terminated_future)
    envelope.future.fulfill true if !envelope.future.nil?
    Concurrent::Actor::Behaviour::MESSAGE_PROCESSED
  else
    pass envelope
  end
end