Class: ConsulBridge::MonitorDockerEventsActor
- Inherits:
-
Concurrent::Actor::RestartingContext
- Object
- Concurrent::Actor::RestartingContext
- ConsulBridge::MonitorDockerEventsActor
- Defined in:
- lib/consul_bridge/monitor_docker_events_actor.rb
Instance Method Summary collapse
-
#initialize(bootstrap_actor:, container_name:) ⇒ MonitorDockerEventsActor
constructor
A new instance of MonitorDockerEventsActor.
- #on_message(message) ⇒ Object
Constructor Details
#initialize(bootstrap_actor:, container_name:) ⇒ MonitorDockerEventsActor
Returns a new instance of MonitorDockerEventsActor.
7 8 9 10 11 12 |
# File 'lib/consul_bridge/monitor_docker_events_actor.rb', line 7 def initialize(bootstrap_actor:, container_name:) @bootstrap_actor = bootstrap_actor @container_name = container_name tell :monitor end |
Instance Method Details
#on_message(message) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/consul_bridge/monitor_docker_events_actor.rb', line 14 def () if == :monitor begin MonitorDockerEvents.call!( container_name: @container_name, handler: ->(event){ @bootstrap_actor << :bootstrap } ) rescue Excon::Errors::SocketError => e if Errno::ENOENT === e.cause puts "Warning: #{e.cause.}; retrying in 30 seconds" Concurrent::ScheduledTask.execute(30){ tell :monitor } end end nil else pass end end |