Skip to content

Commit

Permalink
Merge pull request #21 from peppy/expose-errorsa
Browse files Browse the repository at this point in the history
Add event to allow external visibility of errors
  • Loading branch information
smoogipoo authored Nov 30, 2022
2 parents f818610 + 3657a6f commit fecb213
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions osu.Server.QueueProcessor/QueueProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public abstract class QueueProcessor<T> where T : QueueItem
/// </remarks>
public long TotalErrors => totalErrors;

public event Action<Exception?, T> Error;

/// <summary>
/// The name of this queue, as provided by <see cref="QueueConfiguration"/>.
/// </summary>
Expand Down Expand Up @@ -142,6 +144,8 @@ public void Run(CancellationToken cancellation = default)

Interlocked.Increment(ref consecutiveErrors);

Error?.Invoke(t.Exception, item);

Console.WriteLine($"Error processing {item}: {t.Exception}");
attemptRetry(item);
}
Expand Down

0 comments on commit fecb213

Please sign in to comment.