grpc: terminate subscriptions with UNAVAILABLE on broker shutdown#171
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #171 +/- ##
==========================================
- Coverage 62.10% 62.08% -0.03%
==========================================
Files 37 37
Lines 17088 17094 +6
==========================================
Hits 10612 10612
- Misses 6476 6482 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thank you for the contribution. There are some minor issues with linitng (we are using cargo fmt and clippy). The pre-commit hoo can help with that, see the notes here https://github.com/eclipse-kuksa/kuksa-databroker/blob/main/CONTRIBUTING.md#pre-commit-set-up Also, we require that commits are signed-off and that you "signed" the Eclipse Contributor Agreement, whereas signing means
In case you get stuck, just write. So mich for the formal stuff, wrt to "tech" content @rafaeling do you think these change makes sense/does not break anything? |
Previously, active subscriptions ended with OK on broker shutdown,
which is misleading for clients. Now, subscription streams listen
to the broker shutdown broadcast and terminate with
Status::unavailable("Databroker shutting down").
Fixes eclipse-kuksa#125
Signed-off-by: Harvinder Singh Rathor <harvinderrathor9@gmail.com>
37bb25e to
6c53813
Compare
|
@SebastianSchildt & @rafaeling |
cd40102 to
d28bade
Compare
Signed-off-by: Harvinder Singh Rathor <harvinderrathor9@gmail.com>
d28bade to
af7f1b0
Compare
@SebastianSchildt & @rafaeling |
There was a problem hiding this comment.
Looks good to me and @lukasmittag, the PR doesn't introduces any break changes to kuksa.val.v2.
However, UNAVAILABLE error code is used differently in kuksa.val.v2, we would have to re-check again in the future how to handle it correctly
Bug created: #173

Problem
On broker shutdown, active streaming subscriptions previously completed with OK,
which prevents clients from detecting outage and retrying properly.
Fix
Wrap subscribe streams with a
tokio::select!that also listens to the broker'sshutdown broadcast. When triggered, terminate the stream with
Status::unavailable("Databroker shutting down").Testing
--insecure), subscribed via CLI, published values,sent SIGINT to broker. CLI shows “Server gone, Subscription stopped”.
cargo build,cargo testpass locally.Linked issue
Fixes #125
Signed-off-by: Harvinder Singh Rathor harvinderrathor9@gmail.com