Moved files and introduced IMarkdownToHtmlConverter to avoid packages to handle markdown in core

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-12-04 13:01:58 +01:00
parent 05dc597fc2
commit 21e3cf0887
18 changed files with 63 additions and 42 deletions

View File

@@ -0,0 +1,27 @@
using System;
using Umbraco.Core.Configuration.Models;
namespace Umbraco.Core.Configuration.Extensions
{
public static class HealthCheckSettingsExtensions
{
public static TimeSpan GetNotificationDelay(this HealthChecksSettings settings, ICronTabParser cronTabParser, DateTime now, TimeSpan defaultDelay)
{
// If first run time not set, start with just small delay after application start.
var firstRunTime = settings.Notification.FirstRunTime;
if (string.IsNullOrEmpty(firstRunTime))
{
return defaultDelay;
}
else
{
// Otherwise start at scheduled time according to cron expression, unless within the default delay period.
var firstRunOccurance = cronTabParser.GetNextOccurrence(firstRunTime, now);
var delay = firstRunOccurance - now;
return delay < defaultDelay
? defaultDelay
: delay;
}
}
}
}