1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:52:54 +08:00

Improve log output surrounding score submission

This commit is contained in:
Dean Herbert 2023-10-30 15:07:26 +09:00
parent 5ab20f5db7
commit d90f29a5ff
No known key found for this signature in database

View File

@ -188,7 +188,10 @@ namespace osu.Game.Screens.Play
{
// token may be null if the request failed but gameplay was still allowed (see HandleTokenRetrievalFailure).
if (token == null)
{
Logger.Log("No token, skipping score submission");
return Task.CompletedTask;
}
if (scoreSubmissionSource != null)
return scoreSubmissionSource.Task;
@ -197,6 +200,8 @@ namespace osu.Game.Screens.Play
if (!score.ScoreInfo.Statistics.Any(s => s.Key.IsHit() && s.Value > 0))
return Task.CompletedTask;
Logger.Log($"Beginning score submission (token:{token.Value})...");
scoreSubmissionSource = new TaskCompletionSource<bool>();
var request = CreateSubmissionRequest(score, token.Value);
@ -206,11 +211,12 @@ namespace osu.Game.Screens.Play
score.ScoreInfo.Position = s.Position;
scoreSubmissionSource.SetResult(true);
Logger.Log($"Score submission completed! (token:{token.Value} id:{s.ID})");
};
request.Failure += e =>
{
Logger.Error(e, $"Failed to submit score ({e.Message})");
Logger.Error(e, $"Failed to submit score (token:{token.Value}): {e.Message}");
scoreSubmissionSource.SetResult(false);
};