Renames and puts in temp fix to try to find out why we are binding to old models

This commit is contained in:
Shannon
2019-09-10 11:50:09 +10:00
parent fdad387414
commit 296afb18a4
7 changed files with 39 additions and 15 deletions

View File

@@ -13,9 +13,11 @@ namespace Umbraco.Web.Cache
/// </summary>
/// <remarks>
/// When in Pure Live mode, the models need to be rebuilt before the IPublishedSnapshotService is notified which can result in performance penalties so
/// this performs these actions on a background thread so the user isn't waiting for the rebuilding to occur on a UI thread.
/// this performs these actions on a background thread so the user isn't waiting for the rebuilding to occur on a UI thread.
/// When using this, even when not in Pure Live mode, it still means that the cache is notified on a background thread.
/// In order to wait for the processing to complete, this class has a Wait() method which will block until the processing is finished.
/// </remarks>
public sealed class BackgroundPublishedSnapshotServiceNotifier
public sealed class BackgroundPublishedSnapshotNotifier
{
private readonly IPublishedModelFactory _publishedModelFactory;
private readonly IPublishedSnapshotService _publishedSnapshotService;
@@ -27,7 +29,7 @@ namespace Umbraco.Web.Cache
/// <param name="publishedModelFactory"></param>
/// <param name="publishedSnapshotService"></param>
/// <param name="logger"></param>
public BackgroundPublishedSnapshotServiceNotifier(IPublishedModelFactory publishedModelFactory, IPublishedSnapshotService publishedSnapshotService, ILogger logger)
public BackgroundPublishedSnapshotNotifier(IPublishedModelFactory publishedModelFactory, IPublishedSnapshotService publishedSnapshotService, ILogger logger)
{
_publishedModelFactory = publishedModelFactory;
_publishedSnapshotService = publishedSnapshotService;
@@ -41,7 +43,13 @@ namespace Umbraco.Web.Cache
/// <summary>
/// Blocks until the background operation is completed
/// </summary>
public void Wait() => _runner.StoppedAwaitable.GetAwaiter().GetResult(); //TODO: do we need a try/catch?
/// <returns>Returns true if waiting was necessary</returns>
public bool Wait()
{
var running = _runner.IsRunning;
_runner.StoppedAwaitable.GetAwaiter().GetResult(); //TODO: do we need a try/catch?
return running;
}
/// <summary>
/// Notify the <see cref="IPublishedSnapshotService"/> of content type changes
@@ -101,6 +109,10 @@ namespace Umbraco.Web.Cache
_publishedSnapshotService.Notify(_dataTypePayloads);
if (_contentTypePayloads != null)
_publishedSnapshotService.Notify(_contentTypePayloads);
//Thread.Sleep(10000);
var asdf = "";
});
}

View File

@@ -10,11 +10,11 @@ namespace Umbraco.Web.Cache
{
public sealed class ContentTypeCacheRefresher : PayloadCacheRefresherBase<ContentTypeCacheRefresher, ContentTypeCacheRefresher.JsonPayload>
{
private readonly BackgroundPublishedSnapshotServiceNotifier _backgroundModelFactory;
private readonly BackgroundPublishedSnapshotNotifier _backgroundModelFactory;
private readonly IContentTypeCommonRepository _contentTypeCommonRepository;
private readonly IdkMap _idkMap;
public ContentTypeCacheRefresher(AppCaches appCaches, BackgroundPublishedSnapshotServiceNotifier backgroundModelFactory, IdkMap idkMap, IContentTypeCommonRepository contentTypeCommonRepository)
public ContentTypeCacheRefresher(AppCaches appCaches, BackgroundPublishedSnapshotNotifier backgroundModelFactory, IdkMap idkMap, IContentTypeCommonRepository contentTypeCommonRepository)
: base(appCaches)
{
_backgroundModelFactory = backgroundModelFactory;

View File

@@ -9,10 +9,10 @@ namespace Umbraco.Web.Cache
public sealed class DataTypeCacheRefresher : PayloadCacheRefresherBase<DataTypeCacheRefresher, DataTypeCacheRefresher.JsonPayload>
{
private readonly BackgroundPublishedSnapshotServiceNotifier _backgroundModelFactory;
private readonly BackgroundPublishedSnapshotNotifier _backgroundModelFactory;
private readonly IdkMap _idkMap;
public DataTypeCacheRefresher(AppCaches appCaches, BackgroundPublishedSnapshotServiceNotifier backgroundModelFactory, IdkMap idkMap)
public DataTypeCacheRefresher(AppCaches appCaches, BackgroundPublishedSnapshotNotifier backgroundModelFactory, IdkMap idkMap)
: base(appCaches)
{
_backgroundModelFactory = backgroundModelFactory;