Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace osu.Server.Queues.ScoreStatisticsProcessor.Processors
[UsedImplicitly]
public class ManiaKeyModeUserStatsProcessor : IProcessor
{
public int Order => int.MaxValue;
public int Order => int.MaxValue - 1;

public bool RunOnFailedScores => false;
public bool RunOnLegacyScores => true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static MedalProcessor()
public bool RunOnLegacyScores => true; // This is handled by each awarder.

// This processor needs to run after the play count and hit statistics have been applied, at very least.
public int Order => int.MaxValue;
public int Order => int.MaxValue - 1;

public void RevertFromUserStats(SoloScore score, UserStats userStats, int previousVersion, MySqlConnection conn, MySqlTransaction transaction, List<Action> postTransactionActions)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;

namespace osu.Server.Queues.ScoreStatisticsProcessor.Processors
{
/// <summary>
/// Thrown by <see cref="IProcessor"/>s when the score's processing should be aborted immediately.
/// All side effects from the score processing should either be rolled back or not allowed to happen.
/// </summary>
public class ProcessingAbortedException : Exception
{
public ProcessingAbortedException(string message)
: base(message)
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,19 @@ private void processScore(ScoreItem item, bool force = false)
foreach (IProcessor p in enumerateValidProcessors(score))
{
stopwatch.Restart();
p.ApplyToUserStats(score, userStats, conn, transaction, postTransactionActions);

try
{
p.ApplyToUserStats(score, userStats, conn, transaction, postTransactionActions);
}
catch (ProcessingAbortedException abortException)
{
Console.WriteLine($"Aborting processing of score {item.Score.id}: {abortException.Message}");
tags.Add("type:aborted");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say "This is being added after the tags list is being materialised into an array, so probably won't work." but it turns out there's a second call to populate tags in the finally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was intentional if a bit obfuscated. I'd have caught the exception in the outermost scope but I can't rollback the transaction from there.

Part of me wondered if we even want to datadog this at all, but ultimately I decided that this might come useful.

transaction.Rollback();
return;
}

DogStatsd.Timer("apply_time_elapsed", stopwatch.ElapsedMilliseconds, tags: item.Tags.Append($"processor:{p.GetType().ReadableName()}").ToArray());
}

Expand Down