Пример #1
0
        private void Processor(List <CurrencyInfo> items)
        {
            ServerInstrumentation.Current.Queue(1);

            int n = Environment.TickCount;

            count += items.Count;

            if (items.Count != 0)
            {
                try
                {
                    _service.BatchSave_Info(items);

                    ServerInstrumentation.Current.Process(items.Count);
                }
                catch (Exception ex)
                {
                    ElibExceptionHandler.Handle(ex);
                    ServerInstrumentation.Current.Fault(items.Count);
                    BackUp(items);
                    throw;
                }

                logger.Info(string.Format("Task({0}):\tCurrent:{1}\tAll:{2}\tcost:{3}ms",
                                          index, items.Count, count, Environment.TickCount - n));
            }



            //if (MAX_TIMEOUT > 0)
            //{
            //    Thread.Sleep(MAX_TIMEOUT);
            //}
        }
Пример #2
0
        public void BatchSave_Info(List <Entity.CurrencyInfo> values)
        {
            var action = new Action(() => { service.BatchSave_Info(values); });

            action.BeginInvoke((ar) =>
            {
                action.EndInvoke(ar);
                ServerInstrumentation.Current.Queue(-1);
            }, action);
        }