diff --git a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs b/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs index 919a531549..52cca003b7 100644 --- a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs +++ b/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs @@ -86,7 +86,16 @@ namespace Umbraco.Web.Scheduling finally { if (tempContext != null) + { + // because we created an http context and assigned it to UmbracoContext, + // the batched messenger does batch instructions, but since there is no + // request, we need to explicitely tell it to flush the batch of instrs. + var batchedMessenger = ServerMessengerResolver.Current.Messenger as BatchedDatabaseServerMessenger; + if (batchedMessenger != null) + batchedMessenger.FlushBatch(); + tempContext.Dispose(); // nulls the ThreadStatic context + } } return true; // repeat