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);
            }
        }
        public ActionResult vrlist()
        {
            List <string> list      = null;
            List <string> sortList  = null;
            long          count     = 0;
            long          sortcount = 0;

            using (ServiceStack.Redis.IRedisClient cl = Common.Common.RedisPool.GetClient())
            {
                count = cl.GetListCount(Common.ConfigSettings.RedisListKey);

                list = cl.GetRangeFromList(Common.ConfigSettings.RedisListKey, count > 100 ? (int)(count - 100) : 0, (int)count - 1);

                sortList = cl.GetRangeFromSortedSetDesc(Common.ConfigSettings.RedisSortListKey, 1, 10);

                sortcount = cl.GetSortedSetCount(Common.ConfigSettings.RedisSortListKey);
            }
            ViewBag.list      = string.Join(",", list.ToArray());
            ViewBag.count     = count.ToString();
            ViewBag.qcount    = Common.Common.GetQueueCount().ToString();
            ViewBag.sortlist  = string.Join(",", sortList.ToArray());
            ViewBag.sortcount = sortcount;

            int maxthreadcount = 0;
            //int currthreadcount = 0;
            int availthreadcount = 0;
            int iocouint         = 0;

            ThreadPool.GetMaxThreads(out maxthreadcount, out iocouint);
            ThreadPool.GetAvailableThreads(out availthreadcount, out iocouint);

            ViewBag.maxthreadcount = maxthreadcount;

            ViewBag.availthreadcount = availthreadcount;



            return(View());
        }