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.

This commit is contained in:
Shannon
2016-02-11 18:07:31 +01:00
parent d44542694b
commit 5f246c533c
2 changed files with 5 additions and 6 deletions

View File

@@ -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<int>("SELECT MAX(id) FROM umbracoCacheInstruction");
if (lastId > 0)
SaveLastSynced(lastId);
var maxId = _appContext.DatabaseContext.Database.ExecuteScalar<int>("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)

View File

@@ -551,9 +551,6 @@ namespace Umbraco.Web
// return
foreach (var index in indexes)
yield return index;
// and clear
IndexesToRebuild.Clear();
}