From 5f246c533c9b07113aca3a4974b0ff366a295b24 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 11 Feb 2016 18:07:31 +0100 Subject: [PATCH] Fixes issue when there are zero instructions in the db table and we've never synced before, in this case it will always cold boot because it will never saved the last synced, in this scenario also the indexes will not build because we've cleared the collection before they can run. --- src/Umbraco.Core/Sync/DatabaseServerMessenger.cs | 8 +++++--- src/Umbraco.Web/WebBootManager.cs | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs index 87fc694fd1..d8d828b23e 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs @@ -171,9 +171,11 @@ namespace Umbraco.Core.Sync // go get the last id in the db and store it // note: do it BEFORE initializing otherwise some instructions might get lost // when doing it before, some instructions might run twice - not an issue - var lastId = _appContext.DatabaseContext.Database.ExecuteScalar("SELECT MAX(id) FROM umbracoCacheInstruction"); - if (lastId > 0) - SaveLastSynced(lastId); + var maxId = _appContext.DatabaseContext.Database.ExecuteScalar("SELECT MAX(id) FROM umbracoCacheInstruction"); + + //if there is a max currently, or if we've never synced + if (maxId > 0 || _lastId < 0) + SaveLastSynced(maxId); // execute initializing callbacks if (_options.InitializingCallbacks != null) diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index ffbd50dbf7..c4252223f3 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -551,9 +551,6 @@ namespace Umbraco.Web // return foreach (var index in indexes) yield return index; - - // and clear - IndexesToRebuild.Clear(); }