Class: ConsulStockpile::BackupConsulKVActor
- Inherits:
-
Concurrent::Actor::RestartingContext
- Object
- Concurrent::Actor::RestartingContext
- ConsulStockpile::BackupConsulKVActor
- Defined in:
- lib/consul_stockpile/backup_consul_kv_actor.rb
Instance Method Summary collapse
-
#initialize(bucket:, name:) ⇒ BackupConsulKVActor
constructor
A new instance of BackupConsulKVActor.
- #on_message(message) ⇒ Object
Constructor Details
#initialize(bucket:, name:) ⇒ BackupConsulKVActor
Returns a new instance of BackupConsulKVActor.
7 8 9 10 |
# File 'lib/consul_stockpile/backup_consul_kv_actor.rb', line 7 def initialize(bucket:, name:) @bucket = bucket @name = name end |
Instance Method Details
#on_message(message) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/consul_stockpile/backup_consul_kv_actor.rb', line 12 def () if == :backup Logger.tagged('Backup') do begin BackupConsulKV.call!(bucket: @bucket, name: @name) rescue => e Logger.warn "Warning: #{e.}; retrying in 5 seconds" Logger.warn e.backtrace.join("\n") Concurrent::ScheduledTask.execute(5){ tell :backup } end end nil else pass end end |