NuCache: better fixing, cleanup
This commit is contained in:
@@ -333,7 +333,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
// first get a writer, then a scope
|
||||
// if there already is a scope, the writer will attach to it
|
||||
// otherwise, it will only exist here - cheap
|
||||
using (_contentStore.GetWriter(_scopeProvider))
|
||||
using (_contentStore.GetScopedWriteLock(_scopeProvider))
|
||||
using (var scope = _scopeProvider.CreateScope())
|
||||
{
|
||||
scope.ReadLock(Constants.Locks.ContentTree);
|
||||
@@ -401,7 +401,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
private void LockAndLoadMedia(Action<IScope> action)
|
||||
{
|
||||
// see note in LockAndLoadContent
|
||||
using (_mediaStore.GetWriter(_scopeProvider))
|
||||
using (_mediaStore.GetScopedWriteLock(_scopeProvider))
|
||||
using (var scope = _scopeProvider.CreateScope())
|
||||
{
|
||||
scope.ReadLock(Constants.Locks.MediaTree);
|
||||
@@ -529,7 +529,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
private void LockAndLoadDomains()
|
||||
{
|
||||
// see note in LockAndLoadContent
|
||||
using (_domainStore.GetWriter(_scopeProvider))
|
||||
using (_domainStore.GetScopedWriteLock(_scopeProvider))
|
||||
using (var scope = _scopeProvider.CreateScope())
|
||||
{
|
||||
scope.ReadLock(Constants.Locks.Domains);
|
||||
@@ -586,7 +586,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return;
|
||||
}
|
||||
|
||||
using (_contentStore.GetWriter(_scopeProvider))
|
||||
using (_contentStore.GetScopedWriteLock(_scopeProvider))
|
||||
{
|
||||
NotifyLocked(payloads, out bool draftChanged2, out bool publishedChanged2);
|
||||
draftChanged = draftChanged2;
|
||||
@@ -682,7 +682,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return;
|
||||
}
|
||||
|
||||
using (_mediaStore.GetWriter(_scopeProvider))
|
||||
using (_mediaStore.GetScopedWriteLock(_scopeProvider))
|
||||
{
|
||||
NotifyLocked(payloads, out bool anythingChanged2);
|
||||
anythingChanged = anythingChanged2;
|
||||
@@ -803,7 +803,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
if (removedIds.Count == 0 && refreshedIds.Count == 0 && otherIds.Count == 0 && newIds.Count == 0) return;
|
||||
|
||||
using (store.GetWriter(_scopeProvider))
|
||||
using (store.GetScopedWriteLock(_scopeProvider))
|
||||
{
|
||||
// ReSharper disable AccessToModifiedClosure
|
||||
action(removedIds, refreshedIds, otherIds, newIds);
|
||||
@@ -824,8 +824,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
payload.Removed ? "Removed" : "Refreshed",
|
||||
payload.Id);
|
||||
|
||||
using (_contentStore.GetWriter(_scopeProvider))
|
||||
using (_mediaStore.GetWriter(_scopeProvider))
|
||||
using (_contentStore.GetScopedWriteLock(_scopeProvider))
|
||||
using (_mediaStore.GetScopedWriteLock(_scopeProvider))
|
||||
{
|
||||
// TODO: need to add a datatype lock
|
||||
// this is triggering datatypes reload in the factory, and right after we create some
|
||||
@@ -858,7 +858,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return;
|
||||
|
||||
// see note in LockAndLoadContent
|
||||
using (_domainStore.GetWriter(_scopeProvider))
|
||||
using (_domainStore.GetScopedWriteLock(_scopeProvider))
|
||||
{
|
||||
foreach (var payload in payloads)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user