Remove requirement for configuring start time for scheduled health checks; if not provided, start with short delay after application start
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user