Sha256: 9b9e70c333c38fef32d090b87581396a115d3b12650f1fd257ff86d56cf6619b
Contents?: true
Size: 1.11 KB
Versions: 146
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module SplitIoClient module Cache module Senders class EventsSender def initialize(events_repository, config) @events_repository = events_repository @config = config end def call events_thread if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do |forked| events_thread if forked end end end private def events_thread @config.threads[:events_sender] = Thread.new do begin @config.logger.info('Starting events service') loop do post_events sleep(SplitIoClient::Utilities.randomize_interval(@config.events_push_rate)) end rescue SplitIoClient::SDKShutdownException post_events @config.logger.info('Posting events due to shutdown') end end end def post_events @events_repository.post_events end end end end end
Version data entries
146 entries across 146 versions & 1 rubygems