|
3 | 3 | require "ldclient-rb/impl/event_sender" |
4 | 4 | require "ldclient-rb/impl/event_summarizer" |
5 | 5 | require "ldclient-rb/impl/event_types" |
| 6 | +require "ldclient-rb/impl/non_blocking_thread_pool" |
| 7 | +require "ldclient-rb/impl/simple_lru_cache" |
6 | 8 | require "ldclient-rb/impl/util" |
7 | 9 |
|
8 | 10 | require "concurrent" |
@@ -141,7 +143,7 @@ def initialize(sdk_key, config, client = nil, diagnostic_accumulator = nil, test |
141 | 143 | @inbox_full = Concurrent::AtomicBoolean.new(false) |
142 | 144 |
|
143 | 145 | event_sender = (test_properties || {})[:event_sender] || |
144 | | - Impl::EventSender.new(sdk_key, config, client || Util.new_http_client(config.events_uri, config)) |
| 146 | + Impl::EventSender.new(sdk_key, config, client || Impl::Util.new_http_client(config.events_uri, config)) |
145 | 147 |
|
146 | 148 | @timestamp_fn = (test_properties || {})[:timestamp_fn] || proc { Impl::Util.current_time_millis } |
147 | 149 | @omit_anonymous_contexts = config.omit_anonymous_contexts |
@@ -235,18 +237,18 @@ def initialize(inbox, sdk_key, config, diagnostic_accumulator, event_sender) |
235 | 237 | @event_sender = event_sender |
236 | 238 | @sampler = LaunchDarkly::Impl::Sampler.new(Random.new) |
237 | 239 |
|
238 | | - @context_keys = SimpleLRUCacheSet.new(config.context_keys_capacity) |
| 240 | + @context_keys = Impl::SimpleLRUCacheSet.new(config.context_keys_capacity) |
239 | 241 | @formatter = EventOutputFormatter.new(config) |
240 | 242 | @disabled = Concurrent::AtomicBoolean.new(false) |
241 | 243 | @last_known_past_time = Concurrent::AtomicReference.new(0) |
242 | 244 | @deduplicated_contexts = 0 |
243 | 245 | @events_in_last_batch = 0 |
244 | 246 |
|
245 | 247 | outbox = EventBuffer.new(config.capacity, config.logger) |
246 | | - flush_workers = NonBlockingThreadPool.new(MAX_FLUSH_WORKERS, 'LD/EventDispatcher/FlushWorkers') |
| 248 | + flush_workers = Impl::NonBlockingThreadPool.new(MAX_FLUSH_WORKERS, 'LD/EventDispatcher/FlushWorkers') |
247 | 249 |
|
248 | 250 | if !@diagnostic_accumulator.nil? |
249 | | - diagnostic_event_workers = NonBlockingThreadPool.new(1, 'LD/EventDispatcher/DiagnosticEventWorkers') |
| 251 | + diagnostic_event_workers = Impl::NonBlockingThreadPool.new(1, 'LD/EventDispatcher/DiagnosticEventWorkers') |
250 | 252 | init_event = @diagnostic_accumulator.create_init_event(config) |
251 | 253 | send_diagnostic_event(init_event, diagnostic_event_workers) |
252 | 254 | else |
@@ -383,7 +385,7 @@ def trigger_flush(outbox, flush_workers) |
383 | 385 | @last_known_past_time.value = (result.time_from_server.to_f * 1000).to_i |
384 | 386 | end |
385 | 387 | rescue => e |
386 | | - Util.log_exception(@config.logger, "Unexpected error in event processor", e) |
| 388 | + Impl::Util.log_exception(@config.logger, "Unexpected error in event processor", e) |
387 | 389 | end |
388 | 390 | end |
389 | 391 | outbox.clear if success # Reset our internal state, these events now belong to the flush worker |
|
0 commit comments