Skip to content

Improve error handling and automatic reconnection of PubSub streaming message handler - #1888

Merged
WhitWaldo merged 4 commits into
masterfrom
pubsub-resiliency
Aug 15, 2026
Merged

Improve error handling and automatic reconnection of PubSub streaming message handler#1888
WhitWaldo merged 4 commits into
masterfrom
pubsub-resiliency

Conversation

@WhitWaldo

@WhitWaldo WhitWaldo commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

Improving error handling and automatic reconnection of the PubSub streaming message handler.

This PR supersedes the contribution here by replacing the three independent ContinueWith continuations and their attendant dedupe flags, fault cache and stream-reset coordination with a single Task.WhenAll supervisor that uses plain async/await. This eliminates the entire class of race conditions the original had to patch. Faults surface through the IDaprSubscription. This uses a completion task instead of a cache-and-rethrow-on-next-subscribe model, so callers who never retry can still observe errors. It also wraps multiple exceptions in an AggregateException, resets hasInitialized in finally so re-subscription works after any termination, and adds an ObjectDisposedException guard.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[issue number]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

…sage handler

Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
@WhitWaldo WhitWaldo added this to the v1.18.x - SDK Patches milestone Aug 15, 2026
@WhitWaldo WhitWaldo self-assigned this Aug 15, 2026
@WhitWaldo
WhitWaldo requested review from a team as code owners August 15, 2026 08:22
@codecov

codecov Bot commented Aug 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.81319% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.77%. Comparing base (7469c15) to head (7285c59).

Files with missing lines Patch % Lines
...aging/PublishSubscribe/PublishSubscribeReceiver.cs 86.81% 8 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1888      +/-   ##
==========================================
+ Coverage   62.73%   62.77%   +0.04%     
==========================================
  Files         338      338              
  Lines        9883     9913      +30     
  Branches     1157     1165       +8     
==========================================
+ Hits         6200     6223      +23     
- Misses       3363     3367       +4     
- Partials      320      323       +3     
Flag Coverage Δ
net10.0 62.73% <86.81%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@WhitWaldo
WhitWaldo merged commit a6c5fe5 into master Aug 15, 2026
762 of 768 checks passed
@WhitWaldo
WhitWaldo deleted the pubsub-resiliency branch August 15, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant