1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-28 04:43:37 +08:00

Adjust to prevent runaway errors

This commit is contained in:
smoogipoo 2020-09-02 23:42:44 +09:00
parent fca0324264
commit ae1de1adcb

View File

@ -159,18 +159,16 @@ namespace osu.Game.Collections
}
}
if (saveFailures < 10)
saveFailures = 0;
return true;
}
catch (Exception e)
{
// Since this code is not thread-safe, we may run into random exceptions (such as collection enumeration or out of range indexing).
// Failures are thus only alerted if they exceed a threshold to indicate "actual" errors.
if (++saveFailures >= 10)
{
// Failures are thus only alerted if they exceed a threshold (once) to indicate "actual" errors having occurred.
if (++saveFailures == 10)
Logger.Error(e, "Failed to save collections");
saveFailures = 0;
}
}
return false;