diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-11-04 08:21:43 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-04 08:21:43 -0600 |
| commit | e7aefd66f1992dcecd9454df0771e1f29fae2b1d (patch) | |
| tree | 14da14b514ab3755d03e025f95903eda47c789e0 /src/slskd/Integrations/Pushbullet/PushbulletService.cs | |
| parent | 5ebb679f4f7a24649e5117931e06138a9375110f (diff) | |
| parent | 7f9a694da61bb046343d9f98ec2b5cd8b444e56b (diff) | |
| download | slskd-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/Integrations/Pushbullet/PushbulletService.cs')
| -rw-r--r-- | src/slskd/Integrations/Pushbullet/PushbulletService.cs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/slskd/Integrations/Pushbullet/PushbulletService.cs b/src/slskd/Integrations/Pushbullet/PushbulletService.cs index 5328f4d6..29033381 100644 --- a/src/slskd/Integrations/Pushbullet/PushbulletService.cs +++ b/src/slskd/Integrations/Pushbullet/PushbulletService.cs @@ -145,9 +145,13 @@ namespace slskd.Integrations.Pushbullet Log.LogDebug("Sending Pushbullet notification {Title} {Body}", title, body); await Retry.Do( - task: () => http.PostAsync(PushUri, content), + task: async () => + { + using var response = await http.PostAsync(PushUri, content); + response.EnsureSuccessStatusCode(); + }, isRetryable: (attempts, ex) => true, - onFailure: (attempts, ex) => Log.LogWarning("Failed attempt {Attempts} to send Pushbullet notification {Title} {Body}: {Message}", attempts, title, body, ex.Message), + onFailure: (attempts, ex) => Log.LogWarning("Failed attempt #{Attempts} to send Pushbullet notification {Title} {Body}: {Message}", attempts, title, body, ex.Message), maxAttempts: PushbulletOptions.RetryAttempts, maxDelayInMilliseconds: 30000); |
