mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 07:12:54 +08:00
Merge pull request #16639 from peppy/ef-db-delete-retry
Add more attempts to delete EF database
This commit is contained in:
commit
cc0a8db76a
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -161,9 +162,26 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
recycleThreadContexts();
|
recycleThreadContexts();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int attempts = 10;
|
||||||
|
|
||||||
|
// Retry logic taken from MigratableStorage.AttemptOperation.
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
storage.Delete(DATABASE_NAME);
|
storage.Delete(DATABASE_NAME);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
if (attempts-- == 0)
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
Thread.Sleep(250);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user