Exemplo n.º 1
0
        public static void DownScheduleHandler()
        {
            ServiceStack.Redis.IRedisClient client = GlobalVariable.RedisClient;
            while (true)
            {
                try
                {
                    int count = client.GetListCount(GlobalVariable.PAGE_SEND_CONTENT);
                    for (int i = 0; i < count; i++)
                    {
                        string strUserKey = client.DequeueItemFromList(GlobalVariable.PAGE_SEND_CONTENT);
                        int    machineId  = client.Get <int>(GlobalVariable.PRE_DOWN_INFO_MACHINE + strUserKey);
                        byte[] buff       = client.Get <byte[]>(GlobalVariable.PRE_DOWN_INFO + strUserKey);

                        string        strUser = strUserKey.Substring(0, strUserKey.LastIndexOf('-'));
                        int           intUser = int.Parse(strUser);
                        enumErrorCode result  = CommunicateWithClient(machineId, buff, intUser);
                        if (result != enumErrorCode.HandlerSuccess)
                        {
                            int intResult = (int)result;
                            client.Set <int>(GlobalVariable.PRE_RESP_DOWN_INFO + strUserKey, intResult);
                        }
                    }
                }
                catch (Exception ex)
                {
                    db.InsertErrorInfo(enumSystemErrorCode.TcpSenderException, ex, "outside", null);
                }
                Thread.Sleep(2000);
            }
        }