diff --git a/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs b/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs index 8c533d9bac..0cb89be12f 100644 --- a/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs +++ b/src/Umbraco.Core/Configuration/HealthChecks/HealthCheckNotificationSettingsElement.cs @@ -24,7 +24,7 @@ namespace Umbraco.Core.Configuration.HealthChecks } } - [ConfigurationProperty(FIRST_RUN_TIME_KEY, IsRequired = true)] + [ConfigurationProperty(FIRST_RUN_TIME_KEY, IsRequired = false)] public string FirstRunTime { get diff --git a/src/Umbraco.Web/Scheduling/Scheduler.cs b/src/Umbraco.Web/Scheduling/Scheduler.cs index 85a5843486..6e470ad145 100644 --- a/src/Umbraco.Web/Scheduling/Scheduler.cs +++ b/src/Umbraco.Web/Scheduling/Scheduler.cs @@ -78,11 +78,21 @@ namespace Umbraco.Web.Scheduling if (healthCheckConfig.NotificationSettings.Enabled) { - var delayInMilliseconds = DateTime.Now.PeriodicMinutesFrom(healthCheckConfig.NotificationSettings.FirstRunTime) * 60 * 1000; - if (delayInMilliseconds < DelayMilliseconds) + // If first run time not set, start with just small delay after application start + int delayInMilliseconds; + if (string.IsNullOrEmpty(healthCheckConfig.NotificationSettings.FirstRunTime)) { delayInMilliseconds = DelayMilliseconds; } + else + { + // Otherwise start at scheduled time + delayInMilliseconds = DateTime.Now.PeriodicMinutesFrom(healthCheckConfig.NotificationSettings.FirstRunTime) * 60 * 1000; + if (delayInMilliseconds < DelayMilliseconds) + { + delayInMilliseconds = DelayMilliseconds; + } + } var periodInMilliseconds = healthCheckConfig.NotificationSettings.PeriodInHours * 60 * 60 * 1000; tasks.Add(new HealthCheckNotifier(_healthCheckRunner, delayInMilliseconds, periodInMilliseconds, e.UmbracoContext.Application));