Sha256: 09df807dc983600721d278b746767feb549673f8ce1fc37b901e9850487959bb
Contents?: true
Size: 778 Bytes
Versions: 1
Compression:
Stored size: 778 Bytes
Contents
require 'concurrent' require 'concurrent-edge' require 'consul_stockpile/watch_event' module ConsulStockpile class WatchEventActor < Concurrent::Actor::RestartingContext def initialize(backup_actor:) @backup_actor = backup_actor tell :watch end def on_message(message) if message == :watch Logger.tagged('WatchEvent') do begin WatchEvent.call!( handler: ->(event){ @backup_actor << :backup } ) rescue => e Logger.warn "Warning: #{e.message}; retrying in 5 seconds" Logger.warn e.backtrace.join("\n") Concurrent::ScheduledTask.execute(5){ tell :watch } end end nil else pass end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
consul_stockpile-0.1.5 | lib/consul_stockpile/watch_event_actor.rb |