mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
reduce db access from library manager
This commit is contained in:
parent
cb62ebbf3f
commit
1f1eab209a
@ -705,12 +705,16 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
BaseItem obj;
|
||||
|
||||
if (forceCreation || !_itemsByName.TryGetValue(key, out obj))
|
||||
if (!_itemsByName.TryGetValue(key, out obj))
|
||||
{
|
||||
obj = await CreateItemByName<T>(path, name, cancellationToken, allowSlowProviders).ConfigureAwait(false);
|
||||
|
||||
_itemsByName.AddOrUpdate(key, obj, (keyName, oldValue) => obj);
|
||||
}
|
||||
else if (forceCreation)
|
||||
{
|
||||
await obj.RefreshMetadata(cancellationToken, false, allowSlowProviders: allowSlowProviders).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return obj as T;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user