Class: SplitIoClient::Cache::Senders::LocalhostRepoCleaner

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

Instance Method Summary collapse

Constructor Details

#initialize(impressions_repository, events_repository, config) ⇒ LocalhostRepoCleaner

Returns a new instance of LocalhostRepoCleaner.



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

def initialize(impressions_repository, events_repository, config)
  @impressions_repository = impressions_repository
  @events_repository = events_repository
  @config = config
end

Instance Method Details

#callObject



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

def call
  if ENV['SPLITCLIENT_ENV'] == 'test'
    clear_repositories
  else
    cleaner_thread

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