Exemple #1
0
 private void _redisConnection_ConnectionRestored( object sender, ConnectionFailedEventArgs e )
 {
     // flush the cache when the connection is restored
     if ( e.ConnectionType == ConnectionType.Subscription && _isRedisConnected == false )
     {
         FlushMemoryCache();
         _isRedisConnected = true;
     }
 }
 private void OnConnectionRestored(object sender, ConnectionFailedEventArgs args)
 {
     var handler = ConnectionRestored;
     handler(args.Exception);
 }
				private void SentinelConnectionRestored(object sender, ConnectionFailedEventArgs e)
				{
					// Workaround for StackExchange.Redis/issues/61 that sometimes Redis connection is not connected in ConnectionRestored event 
					while (!_sentinelConnection.IsConnected)
					{
						Task.Delay(200).Wait();
					}
					var subscriber = _sentinelConnection.GetSubscriber();
					subscriber.Subscribe("+switch-master", MasterWasSwitched);
				}
Exemple #4
0
 private void _redisConnection_ConnectionFailed( object sender, ConnectionFailedEventArgs e )
 {
     if ( e.ConnectionType == ConnectionType.Subscription )
     {
         _isRedisConnected = false;
     }
 }
 private void RedisConnection_ConnectionFailed(object sender, StackExchange.Redis.ConnectionFailedEventArgs e)
 {
     EnviarMensajes(REDIS_CLIENT, $"{nameof(RedisConnection_ConnectionFailed) + " - Error en una conexión fisica a redis. No hay conexión, mucha lentitud o el servidor tiene algun inconveniente"}");
 }
        private void SentinelConnectionFailed(object sender, ConnectionFailedEventArgs e)
        {
          _sentinelConnection.ConnectionFailed -= SentinelConnectionFailed;
					_sentinelConnection.ConnectionRestored -= SentinelConnectionRestored;
					_sentinelConnection.Close();
          ConnectToSentinel();
        }
 private void RedisConnection_ConnectionRestored(object sender, StackExchange.Redis.ConnectionFailedEventArgs e)
 {
     EnviarMensajes(REDIS_CLIENT, $"{nameof(RedisConnection_ConnectionRestored) + " - La conexión se restablecio"}");
 }
        private void MuxerInstanceOnConnectionRestored(object sender, ConnectionFailedEventArgs connectionFailedEventArgs)
        {
            var epStr = connectionFailedEventArgs.EndPoint.ToString();
            RedisInstanceBase ins = null;
            if (!redisInstancesDict.TryGetValue(epStr, out ins))
            {
                return;
            }

            var master = ins as MasterInstance;
            if (master == null)
            {
                return;
            }

            if (ins.Group.Master != ins && Program.zkAdaptor.IsLeader(epStr))
            {
                Console.WriteLine("down {0} to slave of {1}", ins.EndPoint, ins.Group.Master.EndPoint);
                ins.Server.SlaveOf(ins.Group.Master.EndPoint);
                MasterToSlave(master);
            }
        }
 private void OnConnectionRestored(object obj, ConnectionFailedEventArgs args)
 {
     // TODO LOGGING
     UpdateConnection();
 }
 /// <summary>
 /// 重新建立连接之前的错误
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void MuxerConnectionRestored(object sender, ConnectionFailedEventArgs e)
 {
     Console.WriteLine("ConnectionRestored: " + e.EndPoint);
 }
 /// <summary>
 /// 连接失败 , 如果重新连接成功你将不会收到这个通知
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void MuxerConnectionFailed(object sender, ConnectionFailedEventArgs e)
 {
     Console.WriteLine("重新连接:Endpoint failed: " + e.EndPoint + ", " + e.FailureType + (e.Exception == null ? "" : (", " + e.Exception.Message)));
 }