From a5c608ba847df1df1179940dbb424eab13451698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Chalet?= Date: Mon, 7 Dec 2020 16:15:01 +0100 Subject: [PATCH] Update the Quartz.NET job to fire at a random date between 1 and 10 minutes after the host starts --- src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs b/src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs index 943e6d2c..8567b71f 100644 --- a/src/OpenIddict.Quartz/OpenIddictQuartzConfiguration.cs +++ b/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)); }); } }