Browse Source

Update the Quartz.NET job to fire at a random date between 1 and 10 minutes after the host starts

pull/1188/head
Kévin Chalet 5 years ago
parent
commit
a5c608ba84
  1. 8
      src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs

8
src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs

@ -33,13 +33,13 @@ namespace OpenIddict.Quartz
options.AddTrigger(builder =>
{
// Note: this trigger uses a quite long interval (1 hour), which means it may be potentially
// never reached if the application is shut down or recycled. As such, this trigger is set up
// to fire 2 minutes after the application starts to ensure it's executed at least once.
// Note: this trigger uses a quite long interval (1 hour), which means it may be potentially never
// reached if the application is shut down or recycled. As such, this trigger is set up to fire
// between 1 and 10 minutes after the application starts to ensure the job is executed at least once.
builder.ForJob(OpenIddictQuartzJob.Identity)
.WithSimpleSchedule(options => options.WithIntervalInHours(1).RepeatForever())
.WithDescription(SR.GetResourceString(SR.ID8002))
.StartAt(DateBuilder.FutureDate(2, IntervalUnit.Minute));
.StartAt(DateBuilder.FutureDate(new Random().Next(1, 10), IntervalUnit.Minute));
});
}
}

Loading…
Cancel
Save