mirror of https://github.com/ppy/osu
Count time spent upwards to display attempts correctly
This commit is contained in:
parent
93809a92d4
commit
e28ee8bc7a
|
@ -849,7 +849,7 @@ public IDisposable BlockAllOperations(string reason)
|
|||
Logger.Log(@"Lock acquired for blocking operations", LoggingTarget.Database);
|
||||
|
||||
const int sleep_length = 200;
|
||||
int timeout = 5000;
|
||||
int timeSpent = 0;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -857,10 +857,10 @@ public IDisposable BlockAllOperations(string reason)
|
|||
while (!Compact())
|
||||
{
|
||||
Thread.Sleep(sleep_length);
|
||||
timeout -= sleep_length;
|
||||
timeSpent += sleep_length;
|
||||
|
||||
if (timeout < 0)
|
||||
throw new TimeoutException($@"Realm compact failed after {timeout / sleep_length} attempts over {timeout / 1000} seconds");
|
||||
if (timeSpent > 5000)
|
||||
throw new TimeoutException($@"Realm compact failed after {timeSpent / sleep_length} attempts over {timeSpent / 1000} seconds");
|
||||
}
|
||||
}
|
||||
catch (RealmException e)
|
||||
|
|
Loading…
Reference in New Issue