mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Don't dispose read contexts
This commit is contained in:
parent
ab34123ba8
commit
50cdb03cd9
@ -56,7 +56,11 @@ namespace osu.Game.Database
|
||||
|
||||
if (currentWriteDidWrite)
|
||||
{
|
||||
// explicitly dispose to ensure any outstanding flushes happen as soon as possible (and underlying resources are purged).
|
||||
usage.Context.Dispose();
|
||||
|
||||
currentWriteDidWrite = false;
|
||||
|
||||
// once all writes are complete, we want to refresh thread-specific contexts to make sure they don't have stale local caches.
|
||||
recycleThreadContexts();
|
||||
}
|
||||
@ -67,14 +71,7 @@ namespace osu.Game.Database
|
||||
}
|
||||
}
|
||||
|
||||
private void recycleThreadContexts()
|
||||
{
|
||||
if (threadContexts != null)
|
||||
foreach (var context in threadContexts.Values)
|
||||
context.Dispose();
|
||||
|
||||
threadContexts = new ThreadLocal<OsuDbContext>(CreateContext, true);
|
||||
}
|
||||
private void recycleThreadContexts() => threadContexts = new ThreadLocal<OsuDbContext>(CreateContext);
|
||||
|
||||
protected virtual OsuDbContext CreateContext()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user