aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Events/EventBus.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2024-11-04 08:21:43 -0600
committerGitHub <noreply@github.com>2024-11-04 08:21:43 -0600
commite7aefd66f1992dcecd9454df0771e1f29fae2b1d (patch)
tree14da14b514ab3755d03e025f95903eda47c789e0 /src/slskd/Events/EventBus.cs
parent5ebb679f4f7a24649e5117931e06138a9375110f (diff)
parent7f9a694da61bb046343d9f98ec2b5cd8b444e56b (diff)
downloadslskd-e7aefd66f1992dcecd9454df0771e1f29fae2b1d.tar.gz
Merge pull request #1238 from slskd/webhooks
Add the ability to call HTTP endpoints (webhooks) when application events are raised
Diffstat (limited to 'src/slskd/Events/EventBus.cs')
-rw-r--r--src/slskd/Events/EventBus.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/slskd/Events/EventBus.cs b/src/slskd/Events/EventBus.cs
index 16b7c9e1..ae3350f0 100644
--- a/src/slskd/Events/EventBus.cs
+++ b/src/slskd/Events/EventBus.cs
@@ -88,7 +88,9 @@ public class EventBus
// we don't care about any of these tasks; contractually we are only obligated to invoke them
_ = Task.WhenAll(subscribers.Select(subscriber =>
Task.Run(() => (subscriber.Value as Func<T, Task>)(data))
- .ContinueWith(task => Log.Error(task.Exception, "Subscriber {Name} for {Type} encountered an error: {Message}", subscriber.Key, typeof(T), task.Exception.Message))));
+ .ContinueWith(
+ task => Log.Error(task.Exception, "Subscriber {Name} for {Type} encountered an error: {Message}", subscriber.Key, typeof(T), task.Exception.Message),
+ continuationOptions: TaskContinuationOptions.OnlyOnFaulted)));
}
else
{
@@ -103,7 +105,9 @@ public class EventBus
// we don't care about any of these tasks; contractually we are only obligated to invoke them
_ = Task.WhenAll(subscribers.Select(subscriber =>
Task.Run(() => (subscriber.Value as Func<Event, Task>)(data))
- .ContinueWith(task => Log.Error(task.Exception, "Catch-All Subscriber {Name} for {Type} encountered an error: {Message}", subscriber.Key, typeof(Event), task.Exception.Message))));
+ .ContinueWith(
+ task => Log.Error(task.Exception, "Catch-All Subscriber {Name} for {Type} encountered an error: {Message}", subscriber.Key, typeof(Event), task.Exception.Message),
+ continuationOptions: TaskContinuationOptions.OnlyOnFaulted)));
}
}