Пример #1
0
        // Closes and restarts the connection (using the same stream URI).
        public async void Restart()
        {
            TimeSpan sleepTime = TimeSpan.FromMilliseconds(0);

            if (_backOff.GetReconnectAttemptCount() > 0 && _config.ReconnectTime > TimeSpan.FromMilliseconds(0))
            {
                sleepTime = _backOff.GetNextBackOff();

                Log.InfoFormat("Stopping LaunchDarkly StreamProcessor. Waiting {0} milliseconds before reconnecting...",
                               sleepTime.TotalMilliseconds);
            }
            else
            {
                _backOff.IncrementReconnectAttemptCount();
            }
            _es.Close();
            await Task.Delay(sleepTime);

            try
            {
                await _es.StartAsync();

                _backOff.ResetReconnectAttemptCount();
                Log.Info("Reconnected to LaunchDarkly StreamProcessor");
            }
            catch (Exception exc)
            {
                Log.ErrorFormat("General Exception: {0}",
                                exc, Util.ExceptionMessage(exc));
            }
        }
Пример #2
0
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         _eventSource?.Close();
         _requestor?.Dispose();
     }
 }
Пример #3
0
 public void Close()
 {
     _close();
     _source.Close();
 }