private void GetValidSentinel()
        {
            while (this.clientManager == null && failures < RedisSentinel.MaxFailures)
            {
                try
                {
                    worker = GetNextSentinel();
                    clientManager = worker.GetClientManager();
                    worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (worker != null)
                    {
                        worker.SentinelError -= Worker_SentinelError;
                        worker.Dispose();
                    }

                    failures++;
                }
            }
        }
Example #2
0
        private void GetValidSentinel()
        {
            while (this.clientManager == null && ShouldRetry())
            {
                try
                {
                    this.worker        = GetNextSentinel();
                    this.clientManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (this.worker != null)
                    {
                        this.worker.SentinelError -= Worker_SentinelError;
                        this.worker.Dispose();
                    }

                    this.failures++;
                }
            }
        }
        private void GetValidSentinel()
        {
            while (this.clientManager == null && ShouldRetry())
            {
                try
                {
                    this.worker = GetNextSentinel();
                    this.clientManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (this.worker != null)
                    {
                        this.worker.SentinelError -= Worker_SentinelError;
                        this.worker.Dispose();
                    }

                    this.failures++;
                }
            }
        }
Example #4
0
        private void GetValidSentinel()
        {
            while (this.clientManager == null && failures < RedisSentinel.MaxFailures)
            {
                try
                {
                    worker        = GetNextSentinel();
                    clientManager = worker.GetClientManager();
                    worker.BeginListeningForConfigurationChanges();
                }
                catch (RedisException)
                {
                    if (worker != null)
                    {
                        worker.SentinelError -= Worker_SentinelError;
                        worker.Dispose();
                    }

                    failures++;
                }
            }
        }
        private RedisSentinelWorker GetValidSentinel()
        {
            if (this.worker != null)
            {
                return(this.worker);
            }

            RedisException lastEx = null;

            while (this.RedisManager == null && ShouldRetry())
            {
                try
                {
                    this.worker       = GetNextSentinel();
                    this.RedisManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                    return(this.worker);
                }
                catch (RedisException ex)
                {
                    if (OnWorkerError != null)
                    {
                        OnWorkerError(ex);
                    }

                    lastEx = ex;
                    if (this.worker != null)
                    {
                        this.worker.Dispose();
                    }

                    this.failures++;
                }
            }

            throw new RedisException("RedisSentinel is not accessible", lastEx);
        }
        private RedisSentinelWorker GetValidSentinel()
        {
            if (this.worker != null)
                return this.worker;

            RedisException lastEx = null;

            while (this.RedisManager == null && ShouldRetry())
            {
                try
                {
                    this.worker = GetNextSentinel();
                    this.RedisManager = worker.GetClientManager();
                    this.worker.BeginListeningForConfigurationChanges();
                    return this.worker;
                }
                catch (RedisException ex)
                {
                    if (OnWorkerError != null)
                        OnWorkerError(ex);

                    lastEx = ex;
                    if (this.worker != null)
                        this.worker.Dispose();

                    this.failures++;
                }
            }

            throw new RedisException("RedisSentinel is not accessible", lastEx);
        }