Browse Source

update

master
wanggang 1 year ago
parent
commit
a8d7584522
  1. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

19
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

@ -66,16 +66,15 @@ public class JobHostdService : BackgroundService, IApplicationService
var now = DateTime.UtcNow;
var nextUtc = expression.GetNextOccurrence(now);
var span = nextUtc - now;
if (span != null)
{
//var delay = span.Value.TotalMilliseconds;
//while (delay > 0)
//{
// var currentDelay = delay > int.MaxValue ? int.MaxValue : (int)delay;
// await Task.Delay(currentDelay).ConfigureAwait(false);
// delay -= currentDelay;
//}
await Task.Delay(span.Value).ConfigureAwait(false);
if (span != null && (int)span.Value.TotalMilliseconds > 0)
{
var delay = (int)span.Value.TotalMilliseconds;
while (delay > 0)
{
var currentDelay = delay > int.MaxValue ? int.MaxValue : delay;
delay -= currentDelay;
await Task.Delay(currentDelay).ConfigureAwait(false);
}
Debug.WriteLine($"{job.Name} 定时任务开始执行");
using var scope = this._serviceProvider.CreateScope();
if (scope.ServiceProvider.GetService(serviceType) is IJobService jobService)

Loading…
Cancel
Save