Sha256: d2a0ce630244d1c118ea6c0700c3f0cf33515ee6e7f3d502f9adca5c72148402
Contents?: true
Size: 1.39 KB
Versions: 54
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true module SplitIoClient module Cache module Senders class ImpressionsSender def initialize(impressions_repository, config, impressions_api) @impressions_repository = impressions_repository @config = config @impressions_api = impressions_api end def call impressions_thread end private def impressions_thread @config.threads[:impressions_sender] = Thread.new do begin @config.logger.info('Starting impressions service') loop do post_impressions(false) sleep(SplitIoClient::Utilities.randomize_interval(@config.impressions_refresh_rate)) end rescue SplitIoClient::SDKShutdownException post_impressions @config.logger.info('Posting impressions due to shutdown') end end end def post_impressions(fetch_all_impressions = true) formatted_impressions = ImpressionsFormatter.new(@impressions_repository) .call(fetch_all_impressions) impressions_api.post(formatted_impressions) rescue StandardError => error @config.log_found_exception(__method__.to_s, error) end def impressions_api @impressions_api end end end end end
Version data entries
54 entries across 54 versions & 1 rubygems