mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Fix recycling never being performed due to incorrect ordering
This commit is contained in:
parent
31ab6f2408
commit
e23e2bd348
@ -64,24 +64,25 @@ namespace osu.Game.Database
|
|||||||
currentWriteDidWrite |= usage.PerformedWrite;
|
currentWriteDidWrite |= usage.PerformedWrite;
|
||||||
currentWriteDidError |= usage.Errors.Any();
|
currentWriteDidError |= usage.Errors.Any();
|
||||||
|
|
||||||
if (usages > 0) return;
|
if (usages == 0)
|
||||||
|
|
||||||
if (currentWriteDidError)
|
|
||||||
currentWriteTransaction?.Rollback();
|
|
||||||
else
|
|
||||||
currentWriteTransaction?.Commit();
|
|
||||||
|
|
||||||
currentWriteTransaction = null;
|
|
||||||
currentWriteDidWrite = false;
|
|
||||||
currentWriteDidError = false;
|
|
||||||
|
|
||||||
if (currentWriteDidWrite)
|
|
||||||
{
|
{
|
||||||
// explicitly dispose to ensure any outstanding flushes happen as soon as possible (and underlying resources are purged).
|
if (currentWriteDidError)
|
||||||
usage.Context.Dispose();
|
currentWriteTransaction?.Rollback();
|
||||||
|
else
|
||||||
|
currentWriteTransaction?.Commit();
|
||||||
|
|
||||||
// once all writes are complete, we want to refresh thread-specific contexts to make sure they don't have stale local caches.
|
if (currentWriteDidWrite || currentWriteDidError)
|
||||||
recycleThreadContexts();
|
{
|
||||||
|
// explicitly dispose to ensure any outstanding flushes happen as soon as possible (and underlying resources are purged).
|
||||||
|
usage.Context.Dispose();
|
||||||
|
|
||||||
|
// once all writes are complete, we want to refresh thread-specific contexts to make sure they don't have stale local caches.
|
||||||
|
recycleThreadContexts();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentWriteTransaction = null;
|
||||||
|
currentWriteDidWrite = false;
|
||||||
|
currentWriteDidError = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
Loading…
x
Reference in New Issue
Block a user