Class: LaunchDarkly::EventDispatcher
- Inherits:
-
Object
- Object
- LaunchDarkly::EventDispatcher
- Defined in:
- lib/ldclient-rb/events.rb
Instance Method Summary collapse
-
#initialize(inbox, sdk_key, config, diagnostic_accumulator, event_sender) ⇒ EventDispatcher
constructor
A new instance of EventDispatcher.
Constructor Details
#initialize(inbox, sdk_key, config, diagnostic_accumulator, event_sender) ⇒ EventDispatcher
Returns a new instance of EventDispatcher.
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/ldclient-rb/events.rb', line 177 def initialize(inbox, sdk_key, config, diagnostic_accumulator, event_sender) @sdk_key = sdk_key @config = config @diagnostic_accumulator = config.diagnostic_opt_out? ? nil : diagnostic_accumulator @event_sender = event_sender @user_keys = SimpleLRUCacheSet.new(config.user_keys_capacity) @formatter = EventOutputFormatter.new(config) @disabled = Concurrent::AtomicBoolean.new(false) @last_known_past_time = Concurrent::AtomicReference.new(0) @deduplicated_users = 0 @events_in_last_batch = 0 outbox = EventBuffer.new(config.capacity, config.logger) flush_workers = NonBlockingThreadPool.new(MAX_FLUSH_WORKERS) if !@diagnostic_accumulator.nil? diagnostic_event_workers = NonBlockingThreadPool.new(1) init_event = @diagnostic_accumulator.create_init_event(config) send_diagnostic_event(init_event, diagnostic_event_workers) else diagnostic_event_workers = nil end Thread.new { main_loop(inbox, outbox, flush_workers, diagnostic_event_workers) } end |