Class: SplitIoClient::Engine::PushManager

Inherits:
Object
  • Object
show all
Defined in:
lib/splitclient-rb/engine/push_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, sse_handler, api_key, telemetry_runtime_producer) ⇒ PushManager

Returns a new instance of PushManager.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/splitclient-rb/engine/push_manager.rb', line 6

def initialize(config, sse_handler, api_key, telemetry_runtime_producer)
  @config = config
  @sse_handler = sse_handler
  @auth_api_client = AuthApiClient.new(@config, telemetry_runtime_producer)
  @api_key = api_key
  @back_off = Engine::BackOff.new(@config.auth_retry_back_off_base, 1)
  @telemetry_runtime_producer = telemetry_runtime_producer
  # Serializes start_sse: it is reachable from the push status handler thread and
  # from the token refresh thread concurrently.
  @start_sse_mutex = Mutex.new
end

Instance Method Details

#start_sseObject



18
19
20
# File 'lib/splitclient-rb/engine/push_manager.rb', line 18

def start_sse
  @start_sse_mutex.synchronize { start_sse_unsynchronized }
end

#stop_sseObject



22
23
24
25
26
27
# File 'lib/splitclient-rb/engine/push_manager.rb', line 22

def stop_sse
  @sse_handler.stop
  SplitIoClient::Helpers::ThreadHelper.stop(:schedule_next_token_refresh, @config)
rescue StandardError => e
  @config.logger.error(e.inspect)
end