public void Dispose()
 {
     if (_pipeline != null)
     {
         _pipeline.Dispose();
     }
     if (_client != null)
     {
         _client.Dispose();
     }
 }
        private async Task <IRedisPipeline> ReplaceErrorPipelineAsync(int currentIndex, IRedisPipeline pipeline)
        {
            _diagnosticSource.LogEvent("ReplaceErrorPipelineStart", new { CurrentIndex = currentIndex });
            var endpoint = await EndpointResolution.GetEndpointAsync(_configuration.Endpoints[0]).ConfigureAwait(false);

            var newPipeline = await ConnectPipelineAsync(currentIndex, endpoint.Item1, endpoint.Item2).ConfigureAwait(false);

            _pipelines[currentIndex] = Task.FromResult(newPipeline);

            try
            {
                pipeline.ThrowErrorForRemainingResponseQueueItems();
                pipeline.SaveQueue(newPipeline);
                pipeline.Dispose();
            }
            catch (Exception)
            {
                // Ignore
            }

            _diagnosticSource.LogEvent("ReplaceErrorPipelineStop", new { CurrentIndex = currentIndex });
            return(newPipeline);
        }