Пример #1
0
        public void Teardown()
        {
            _actionQueue?.Teardown();
            _requestHandler.Teardown();
            _packageQueue.Clear();

            _actionQueue     = null;
            _requestHandler  = null;
            _activityHandler = null;
            _packageQueue    = null;
            _logger          = null;
            _backoffStrategy = null;
        }
Пример #2
0
        public void Teardown()
        {
            _actionQueue?.Teardown();
            _packageQueue?.Clear();
            _activityHandlerWeakReference.SetTarget(null);
            _requestHandler.Teardown();

            _actionQueue     = null;
            _logger          = null;
            _packageQueue    = null;
            _backoffStrategy = null;
            _requestHandler  = null;
            _activityHandlerWeakReference = null;
        }
Пример #3
0
        public static void Teardown()
        {
            _iPackageHandler     = null;
            _iRequestHandler     = null;
            _iAttributionHandler = null;
            _logger = null;
            _httpMessageHandler?.Dispose();
            _httpMessageHandler             = null;
            _packageHandlerBackoffStrategy  = null;
            _sdkClickHandlerBackoffStrategy = null;

            _timerInterval      = DefaultTimerInterval;
            _timerStart         = DefaultTimerStart;
            _sessionInterval    = DefaultSessionInterval;
            _subsessionInterval = DefaultSubsessionInterval;
            _maxDelayStart      = DefaultMaxDelayStart;
            _baseUrl            = Constants.BASE_URL;
        }
Пример #4
0
        internal static TimeSpan WaitingTime(int retries, BackoffStrategy backoffStrategy)
        {
            if (retries < backoffStrategy.MinRetries)
            {
                return(TimeSpan.Zero);
            }

            // Start with base 0
            int baseValue = retries - backoffStrategy.MinRetries;

            // Get the exponential Time from the base: 1, 2, 4, 8, 16, ... * times the multiplier
            long exponentialTimeTicks = (long)Math.Pow(2, baseValue) * backoffStrategy.TicksMultiplier;

            // Limit the maximum allowed time to wait
            long ceilingTimeTicks = Math.Min(exponentialTimeTicks, backoffStrategy.MaxWaitTicks);

            // get the random range
            double randomRange = GetRandomNumber(backoffStrategy.MinRange, backoffStrategy.MaxRange);

            // Apply jitter factor
            double waitingTimeTicks = ceilingTimeTicks * randomRange;

            return(TimeSpan.FromTicks((long)exponentialTimeTicks));
        }
Пример #5
0
 public static void SetSdkClickHandlerBackoffStrategy(BackoffStrategy backoffStrategy)
 {
     _sdkClickHandlerBackoffStrategy = backoffStrategy;
 }
Пример #6
0
 public static void SetPackageHandlerBackoffStrategy(BackoffStrategy backoffStrategy)
 {
     _packageHandlerBackoffStrategy = backoffStrategy;
 }