public Task Execute(IJobExecutionContext context) { return(Task.Run(() => { try { foreach (var item in SRC.data) { if (Tasks >= Config.MaxTasks) { Thread.Sleep(100); } Tasks++; var now = UnixTime.Seconds(DateTime.Now); if ((now - item.service_utc_time) > 60) { item.service_status = service_status_enum.offLine.ToString(); if (LogHelper.enable) { Console.WriteLine("Loop-----------------------" + DateTime.Now); } } } } catch (Exception e) { Console.WriteLine(e.Message.ToString()); } finally { Tasks = 0; } })); }