reduce db access from library manager

pull/702/head
Luke Pulverenti 12 years ago
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…
Cancel
Save