Class: SplitIoClient::SSE::NotificationManagerKeeper
- Inherits:
-
Object
- Object
- SplitIoClient::SSE::NotificationManagerKeeper
- Defined in:
- lib/splitclient-rb/sse/notification_manager_keeper.rb
Constant Summary collapse
- DISABLED =
0- ENABLED =
1- PAUSED =
2
Instance Method Summary collapse
- #handle_incoming_occupancy_event(event) ⇒ Object
-
#initialize(config, telemetry_runtime_producer) {|_self| ... } ⇒ NotificationManagerKeeper
constructor
A new instance of NotificationManagerKeeper.
- #on_action(&action) ⇒ Object
Constructor Details
#initialize(config, telemetry_runtime_producer) {|_self| ... } ⇒ NotificationManagerKeeper
Returns a new instance of NotificationManagerKeeper.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/splitclient-rb/sse/notification_manager_keeper.rb', line 12 def initialize(config, telemetry_runtime_producer) @config = config @publisher_available = Concurrent::AtomicBoolean.new(true) @publishers_pri = Concurrent::AtomicFixnum.new @publishers_sec = Concurrent::AtomicFixnum.new @on = { action: ->(_) {} } @telemetry_runtime_producer = telemetry_runtime_producer yield self if block_given? end |
Instance Method Details
#handle_incoming_occupancy_event(event) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/splitclient-rb/sse/notification_manager_keeper.rb', line 23 def handle_incoming_occupancy_event(event) if event.data['type'] == 'CONTROL' process_event_control(event.data['controlType']) else process_event_occupancy(event.channel, event.data['metrics']['publishers']) end rescue StandardError => e p e @config.logger.error(e) end |
#on_action(&action) ⇒ Object
34 35 36 |
# File 'lib/splitclient-rb/sse/notification_manager_keeper.rb', line 34 def on_action(&action) @on[:action] = action end |