1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:22:56 +08:00

Add more attempts to delete EF database

Just noticed in passing. Probably best we do this since it was known to
fail on windows in some rare cases.
This commit is contained in:
Dean Herbert 2022-01-27 14:32:20 +09:00
parent de5ac7ad83
commit 587c0f965c

View File

@ -1,6 +1,7 @@
// 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.
using System;
using System.IO;
using System.Linq;
using System.Threading;
@ -161,9 +162,26 @@ namespace osu.Game.Database
{
recycleThreadContexts();
try
{
int attempts = 10;
// Retry logic taken from MigratableStorage.AttemptOperation.
while (true)
{
try
{
storage.Delete(DATABASE_NAME);
return;
}
catch (Exception)
{
if (attempts-- == 0)
throw;
}
Thread.Sleep(250);
}
}
catch
{