Class: SplitIoClient::Cache::Senders::ImpressionsSender

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

Instance Method Summary collapse

Constructor Details

#initialize(impressions_repository, api_key) ⇒ ImpressionsSender

Returns a new instance of ImpressionsSender.



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

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

Instance Method Details

#call ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/splitclient-rb/cache/senders/impressions_sender.rb', line 12

def call
  if SplitIoClient.configuration.disable_impressions
    SplitIoClient.configuration.logger.info('Disabling impressions service by config')
    return
  end

  if ENV['SPLITCLIENT_ENV'] == 'test'
    post_impressions
  else
    impressions_thread

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