Class: SplitIoClient::Cache::Senders::EventsSender

Inherits:
Object
  • Object
show all
Defined in:
lib/splitclient-rb/cache/senders/events_sender.rb

Instance Method Summary collapse

Constructor Details

#initialize(events_repository, api_key) ⇒ EventsSender

Returns a new instance of EventsSender.



7
8
9
10
# File 'lib/splitclient-rb/cache/senders/events_sender.rb', line 7

def initialize(events_repository, api_key)
  @events_repository = events_repository
  @api_key = api_key
end

Instance Method Details

#call ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/splitclient-rb/cache/senders/events_sender.rb', line 12

def call
  if ENV['SPLITCLIENT_ENV'] == 'test'
    post_events
  else
    events_thread

    if defined?(PhusionPassenger)
      PhusionPassenger.on_event(:starting_worker_process) do |forked|
        events_thread if forked
      end
    end
  end
end