fix: Add CancellationToken to Slack and remove unused IHttpClientFactory#1691
Conversation
…sed IHttpClientFactory (#1547, #1583) - Add CancellationToken parameter to ISlack.PostWebHookMessage interface - Update Slack implementation to accept and check CancellationToken - Remove unused IHttpClientFactory parameter from Http class constructor Fixes #1547, #1583 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
SummaryThis PR adds CancellationToken support to the Slack webhook method and removes an unused IHttpClientFactory parameter from the Http class constructor. Critical Issues1. Incomplete CancellationToken implementation in Slack.PostWebHookMessage The PR adds a public async Task PostWebHookMessage(SlackWebHookOptions options, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
var slackClient = new SlackClient(options.WebHookUri.AbsoluteUri, httpClient: _http.GetLoggingHttpClient());
await slackClient.PostAsync(options.SlackMessage); // ❌ Missing cancellationToken
}This means:
Expected fix: await slackClient.PostAsync(options.SlackMessage, cancellationToken);If the Slack.Webhooks library doesn't support cancellation tokens in PostAsync, then:
SuggestionsIHttpClientFactory removal looks correct ✅ The Http constructor parameter removal appears valid since:
However, verify that:
Previous Review StatusUnable to access previous comments due to GitHub token scope limitations. Verdict |
Summary
CancellationTokenparameter toISlack.PostWebHookMessagefor proper cancellation supportIHttpClientFactoryparameter fromHttp.csconstructorChanges
ISlack.cs: Added optional CancellationToken parameter to PostWebHookMessageSlack.cs: Implemented cancellation token check in PostWebHookMessageHttp.cs: Removed unused IHttpClientFactory from constructorFixes #1547, Fixes #1583
Test plan
🤖 Generated with Claude Code