1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Only attempt to disable rulesets when decidedly crashing out

This commit is contained in:
Bartłomiej Dach 2024-03-25 11:33:15 +01:00
parent c7c0330265
commit fb08d6816b
No known key found for this signature in database

View File

@ -678,18 +678,21 @@ namespace osu.Game
/// <summary> /// <summary>
/// Allows a maximum of one unhandled exception, per second of execution. /// Allows a maximum of one unhandled exception, per second of execution.
/// </summary> /// </summary>
/// <returns>Whether to ignore the exception and continue running.</returns>
private bool onExceptionThrown(Exception ex) private bool onExceptionThrown(Exception ex)
{ {
bool continueExecution = Interlocked.Decrement(ref allowableExceptions) >= 0; if (Interlocked.Decrement(ref allowableExceptions) < 0)
{
Logger.Log($"Unhandled exception has been {(continueExecution ? $"allowed with {allowableExceptions} more allowable exceptions" : "denied")} ."); Logger.Log("Too many unhandled exceptions, crashing out.");
RulesetStore.TryDisableCustomRulesetsCausing(ex);
RulesetStore.TryDisableCustomRulesetsCausing(ex); return false;
}
Logger.Log($"Unhandled exception has been allowed with {allowableExceptions} more allowable exceptions.");
// restore the stock of allowable exceptions after a short delay. // restore the stock of allowable exceptions after a short delay.
Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions)); Task.Delay(1000).ContinueWith(_ => Interlocked.Increment(ref allowableExceptions));
return continueExecution; return true;
} }
protected override void Dispose(bool isDisposing) protected override void Dispose(bool isDisposing)