Scheduler - does not run tasks if not MainDom

This commit is contained in:
Stephan
2015-07-06 17:47:21 +02:00
parent 2d5bfc0fe2
commit 9be2f99e7b
4 changed files with 36 additions and 8 deletions

View File

@@ -29,11 +29,18 @@ namespace Umbraco.Web.Scheduling
{
if (_appContext == null) return true; // repeat...
string umbracoAppUrl = null;
try
// ensure we do not run if not main domain, but do NOT lock it
if (_appContext.MainDom.IsMainDom == false)
{
using (DisposableTimer.DebugDuration<KeepAlive>(() => "Keep alive executing", () => "Keep alive complete"))
LogHelper.Debug<ScheduledPublishing>("Does not run if not MainDom.");
return false; // do NOT repeat, going down
}
using (DisposableTimer.DebugDuration<KeepAlive>(() => "Keep alive executing", () => "Keep alive complete"))
{
string umbracoAppUrl = null;
try
{
umbracoAppUrl = _appContext.UmbracoApplicationUrl;
if (umbracoAppUrl.IsNullOrWhiteSpace())
@@ -54,10 +61,10 @@ namespace Umbraco.Web.Scheduling
var result = await wc.SendAsync(request, token);
}
}
}
catch (Exception e)
{
LogHelper.Error<KeepAlive>(string.Format("Failed (at \"{0}\").", umbracoAppUrl), e);
catch (Exception e)
{
LogHelper.Error<KeepAlive>(string.Format("Failed (at \"{0}\").", umbracoAppUrl), e);
}
}
return true; // repeat

View File

@@ -65,6 +65,13 @@ namespace Umbraco.Web.Scheduling
return false; // do NOT repeat, server status comes from config and will NOT change
}
// ensure we do not run if not main domain, but do NOT lock it
if (_appContext.MainDom.IsMainDom == false)
{
LogHelper.Debug<LogScrubber>("Does not run if not MainDom.");
return false; // do NOT repeat, going down
}
using (DisposableTimer.DebugDuration<LogScrubber>("Log scrubbing executing", "Log scrubbing complete"))
{
Log.CleanLogs(GetLogScrubbingMaximumAge(_settings));

View File

@@ -38,6 +38,13 @@ namespace Umbraco.Web.Scheduling
return false; // do NOT repeat, server status comes from config and will NOT change
}
// ensure we do not run if not main domain, but do NOT lock it
if (_appContext.MainDom.IsMainDom == false)
{
LogHelper.Debug<ScheduledPublishing>("Does not run if not MainDom.");
return false; // do NOT repeat, going down
}
using (DisposableTimer.DebugDuration<ScheduledPublishing>(() => "Scheduled publishing executing", () => "Scheduled publishing complete"))
{
string umbracoAppUrl = null;

View File

@@ -101,6 +101,13 @@ namespace Umbraco.Web.Scheduling
return false; // do NOT repeat, server status comes from config and will NOT change
}
// ensure we do not run if not main domain, but do NOT lock it
if (_appContext.MainDom.IsMainDom == false)
{
LogHelper.Debug<ScheduledTasks>("Does not run if not MainDom.");
return false; // do NOT repeat, going down
}
using (DisposableTimer.DebugDuration<ScheduledTasks>(() => "Scheduled tasks executing", () => "Scheduled tasks complete"))
{
try