U4-5728 - Do not run KeepAlive, ScheduledPublishing, without an url
Updates the scheduler and the scheduled tasks to use a background task runner (ported from new courier codebase with tests) so that they are web aware and wind down properly.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
@@ -8,24 +10,33 @@ namespace Umbraco.Web.Scheduling
|
||||
{
|
||||
internal class KeepAlive
|
||||
{
|
||||
public static void Start(object sender)
|
||||
public static void Start(ApplicationContext appContext, IUmbracoSettingsSection settings)
|
||||
{
|
||||
using (DisposableTimer.DebugDuration<KeepAlive>(() => "Keep alive executing", () => "Keep alive complete"))
|
||||
{
|
||||
var umbracoBaseUrl = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl();
|
||||
var umbracoBaseUrl = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl(
|
||||
appContext,
|
||||
settings);
|
||||
|
||||
var url = string.Format("{0}/ping.aspx", umbracoBaseUrl);
|
||||
|
||||
try
|
||||
if (string.IsNullOrWhiteSpace(umbracoBaseUrl))
|
||||
{
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
wc.DownloadString(url);
|
||||
}
|
||||
LogHelper.Warn<KeepAlive>("No url for service (yet), skip.");
|
||||
}
|
||||
catch (Exception ee)
|
||||
else
|
||||
{
|
||||
LogHelper.Error<KeepAlive>("Error in ping", ee);
|
||||
var url = string.Format("{0}/ping.aspx", umbracoBaseUrl);
|
||||
|
||||
try
|
||||
{
|
||||
using (var wc = new WebClient())
|
||||
{
|
||||
wc.DownloadString(url);
|
||||
}
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<KeepAlive>("Error in ping", ee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user