Class: ConsulBridge::BootstrapConsulActor
- Inherits:
-
Concurrent::Actor::RestartingContext
- Object
- Concurrent::Actor::RestartingContext
- ConsulBridge::BootstrapConsulActor
- Defined in:
- lib/consul_bridge/bootstrap_consul_actor.rb
Instance Method Summary collapse
-
#initialize(bucket:, join_all: false) ⇒ BootstrapConsulActor
constructor
A new instance of BootstrapConsulActor.
- #on_message(message) ⇒ Object
Constructor Details
#initialize(bucket:, join_all: false) ⇒ BootstrapConsulActor
Returns a new instance of BootstrapConsulActor.
7 8 9 10 |
# File 'lib/consul_bridge/bootstrap_consul_actor.rb', line 7 def initialize(bucket:, join_all: false) @bucket = bucket @join_all = join_all end |
Instance Method Details
#on_message(message) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/consul_bridge/bootstrap_consul_actor.rb', line 12 def () if == :bootstrap begin BootstrapConsul.call!(bucket: @bucket, join_all: @join_all) rescue => e puts "Warning: #{e.}; retrying in 5 seconds" Concurrent::ScheduledTask.execute(5){ tell :bootstrap } end nil else pass end end |