1.c#中使用quartz执行一个定时任务(任务中使用了Parallel.For多线程)执行2个小时就会暂停一段时间?
//计算日期是星期一
if (tc.DayOfWeek == DayOfWeek.Monday)
{
ProjectUserRelationReadRepository proj = new ProjectUserRelationReadRepository();
var projsCount = proj.QueryProjectPeriod(tc.AddDays(7));
int pageSize = 1000;
int totalPageCount = ((int)projsCount + pageSize - 1) / pageSize;
int count = (int)Math.Ceiling((double)totalPageCount / 2);
for (var j = 0; j < count; j++)
{
Parallel.For(0, 2, i =>
{
var projs = proj.QueryProjectPeriod(tc.AddDays(7), 2 * j + i, pageSize);
foreach (var p in projs)
{
try
{
var str = _reporterServices.CreatePage_Week_V2(tc, p);
}
catch (Exception ex)
{
_logger.Error(p, ex);
}
}
});
}
}