Skip to content

Commit

Permalink
Ensure we clean the keyCache after a report.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jump committed May 13, 2020
1 parent 1162da0 commit 6dcc74b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Dist/package.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off

SET config=release
REM SET config=debug
REM SET config=release
SET config=debug

@Echo Packaging for %config%
nuget pack ..\uSync8.Core\uSync.Core.nuspec -build -OutputDirectory %1 -version %1 -properties "depends=%1;Configuration=%config%"
Expand Down
2 changes: 1 addition & 1 deletion uSync8.BackOffice/Services/uSyncService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
Expand Down
10 changes: 7 additions & 3 deletions uSync8.BackOffice/SyncHandlers/SyncHandlerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ protected virtual IEnumerable<uSyncAction> CleanFolder(string cleanFile, bool re
/// </remarks>
private IList<Guid> GetFolderKeys(string folder, bool flat)
{
// if it's flat, then we only need to load all the keys once per handler
var folderKey = flat == true ? 1 : folder.GetHashCode();
// We only need to load all the keys once per handler (if all items are in a folder that key will be used).
var folderKey = folder.GetHashCode();

var cacheKey = $"uSyncKeyList_{folderKey}_{this.Alias}";
var cacheKey = $"keycache_{this.Alias}_{folderKey}";
return runtimeCache.GetCacheItem(cacheKey, () =>
{
var keys = new List<Guid>();
Expand Down Expand Up @@ -574,12 +574,16 @@ public IEnumerable<uSyncAction> Report(string folder, HandlerSettings config, Sy
{
var actions = new List<uSyncAction>();

runtimeCache.ClearByKey($"keycache_{this.Alias}");

callback?.Invoke("Checking Actions", 1, 3);
actions.AddRange(ReportFolder(folder, config, callback));

callback?.Invoke("Validating Report", 2, 3);
actions = ValidateReport(folder, actions);

runtimeCache.ClearByKey($"keycache_{this.Alias}");

callback?.Invoke("Done", 3, 3);
return actions;
}
Expand Down

0 comments on commit 6dcc74b

Please sign in to comment.