コード例 #1
0
        private async void DoWork(object state)
        {
            _timer?.Change(Timeout.Infinite, 0);
            _logger.LogDebug("服务开始工作……");
            stopwatch.Restart();
            await RobotHelper.Send(robotSetting, _logger);

            stopwatch.Stop();
            _logger.LogDebug($"------------------总耗时:{(double)stopwatch.ElapsedMilliseconds/1000}秒---------------");
            _timer?.Change(TimeSpan.FromMilliseconds(robotSetting.PollingTime), TimeSpan.Zero);
        }