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; saveFailures = 0;
return true; return true;
} }
catch (Exception e) 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). // 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. // Failures are thus only alerted if they exceed a threshold (once) to indicate "actual" errors having occurred.
if (++saveFailures >= 10) if (++saveFailures == 10)
{
Logger.Error(e, "Failed to save collections"); Logger.Error(e, "Failed to save collections");
saveFailures = 0;
}
} }
return false; return false;