// 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)); } }
private void Dispose(bool disposing) { if (disposing) { _eventSource?.Close(); _requestor?.Dispose(); } }
public void Close() { _close(); _source.Close(); }