Skip to content

Commit ecfaee3

Browse files
rbottemaAndyButland
authored andcommitted
Lock appropriate tree for media operations (#19422)
The MediaService currently locks the ContentTree for GetPagedOfType(s) operations, but it's querying the MediaTree. This ensures we lock the correct tree.
1 parent 8018396 commit ecfaee3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Umbraco.Core/Services/MediaService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ public IEnumerable<IMedia> GetPagedOfType(int contentTypeId, long pageIndex, int
421421
}
422422

423423
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
424-
scope.ReadLock(Constants.Locks.ContentTree);
424+
scope.ReadLock(Constants.Locks.MediaTree);
425425
return _mediaRepository.GetPage(Query<IMedia>()?.Where(x => x.ContentTypeId == contentTypeId), pageIndex, pageSize, out totalRecords, filter, ordering);
426426
}
427427

@@ -444,7 +444,7 @@ public IEnumerable<IMedia> GetPagedOfTypes(int[] contentTypeIds, long pageIndex,
444444
}
445445

446446
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
447-
scope.ReadLock(Constants.Locks.ContentTree);
447+
scope.ReadLock(Constants.Locks.MediaTree);
448448
return _mediaRepository.GetPage(
449449
Query<IMedia>()?.Where(x => contentTypeIds.Contains(x.ContentTypeId)), pageIndex, pageSize, out totalRecords, filter, ordering);
450450
}

0 commit comments

Comments
 (0)