U4-10538 Disable Ping on front-end nodes when load balancing
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
namespace Umbraco.Web.Scheduling
|
||||
{
|
||||
@@ -20,9 +21,21 @@ namespace Umbraco.Web.Scheduling
|
||||
_appContext = appContext;
|
||||
}
|
||||
|
||||
private ILogger Logger { get { return _appContext.ProfilingLogger.Logger; } }
|
||||
|
||||
public override async Task<bool> PerformRunAsync(CancellationToken token)
|
||||
{
|
||||
if (_appContext == null) return true; // repeat...
|
||||
|
||||
switch (_appContext.GetCurrentServerRole())
|
||||
{
|
||||
case ServerRole.Slave:
|
||||
Logger.Debug<ScheduledPublishing>("Does not run on slave servers.");
|
||||
return true; // DO repeat, server role can change
|
||||
case ServerRole.Unknown:
|
||||
Logger.Debug<ScheduledPublishing>("Does not run on servers with unknown role.");
|
||||
return true; // DO repeat, server role can change
|
||||
}
|
||||
|
||||
// ensure we do not run if not main domain, but do NOT lock it
|
||||
if (_appContext.MainDom.IsMainDom == false)
|
||||
@@ -31,7 +44,7 @@ namespace Umbraco.Web.Scheduling
|
||||
return false; // do NOT repeat, going down
|
||||
}
|
||||
|
||||
using (DisposableTimer.DebugDuration<KeepAlive>(() => "Keep alive executing", () => "Keep alive complete"))
|
||||
using (_appContext.ProfilingLogger.DebugDuration<KeepAlive>("Keep alive executing", "Keep alive complete"))
|
||||
{
|
||||
string umbracoAppUrl = null;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Scheduling
|
||||
|
||||
private ILogger Logger { get { return _appContext.ProfilingLogger.Logger; } }
|
||||
|
||||
public override async Task<bool> PerformRunAsync(CancellationToken token)
|
||||
public override bool PerformRun()
|
||||
{
|
||||
if (_appContext == null) return true; // repeat...
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Umbraco.Web.Scheduling
|
||||
|
||||
public override bool IsAsync
|
||||
{
|
||||
get { return true; }
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user