diff --git a/uSync.BackOffice/Services/SyncService.cs b/uSync.BackOffice/Services/SyncService.cs index 236a8c7b..9e5f26cf 100644 --- a/uSync.BackOffice/Services/SyncService.cs +++ b/uSync.BackOffice/Services/SyncService.cs @@ -56,6 +56,8 @@ public partial class SyncService : ISyncService private readonly IAppCache _appCache; + private readonly DistributedCache _distributedCache; + /// /// Create a new uSyncService (done via DI) /// @@ -69,7 +71,8 @@ public SyncService( AppCaches appCaches, ICoreScopeProvider scopeProvider, ILoggerFactory loggerFactory, - IBackgroundTaskQueue backgroundTaskQueue) + IBackgroundTaskQueue backgroundTaskQueue, + DistributedCache distributedCache) { this._logger = logger; @@ -88,7 +91,7 @@ public SyncService( _loggerFactory = loggerFactory; _backgroundTaskQueue = backgroundTaskQueue; - + _distributedCache = distributedCache; } /// > @@ -189,7 +192,15 @@ public async Task> StartupImportAsync(string[] folders, handlerOptions ??= new SyncHandlerOptions(); handlerOptions.Action = HandlerActions.Import; var handlers = _handlerFactory.GetValidHandlers(handlerOptions); - return await ImportAsync(folders, force, handlers, handlerOptions, callbacks); + + var changes = await ImportAsync(folders, force, handlers, handlerOptions, callbacks); + + // on first boot, we refresh the snapshot cache if we have imported any content + // just because it seems not to refresh as part of the boot. + if (changes.Any(x => x.Change > ChangeType.NoChange && x.ItemType == "IContent")) + _distributedCache.RefreshAllPublishedSnapshot(); + + return changes; } /// >