Class: ConsulStockpile::BootstrapConsulKVActor
- Inherits:
-
Concurrent::Actor::RestartingContext
- Object
- Concurrent::Actor::RestartingContext
- ConsulStockpile::BootstrapConsulKVActor
- Defined in:
- lib/consul_stockpile/bootstrap_consul_kv_actor.rb
Instance Method Summary collapse
-
#initialize(backup_actor:, bucket:) ⇒ BootstrapConsulKVActor
constructor
A new instance of BootstrapConsulKVActor.
- #on_message(message) ⇒ Object
Constructor Details
#initialize(backup_actor:, bucket:) ⇒ BootstrapConsulKVActor
Returns a new instance of BootstrapConsulKVActor.
8 9 10 11 12 |
# File 'lib/consul_stockpile/bootstrap_consul_kv_actor.rb', line 8 def initialize(backup_actor:, bucket:) @backup_actor = backup_actor @bucket = bucket tell :bootstrap end |
Instance Method Details
#on_message(message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/consul_stockpile/bootstrap_consul_kv_actor.rb', line 14 def () if == :bootstrap Logger.tagged('Bootstrap') do begin ran_bootstrap = BootstrapConsulKV.call(bucket: @bucket).ran_bootstrap @backup_actor << :backup if ran_bootstrap rescue => e Logger.warn "Warning: #{e.}; retrying in 5 seconds" Concurrent::ScheduledTask.execute(5){ tell :bootstrap } end end else pass end end |