-
Notifications
You must be signed in to change notification settings - Fork 276
pubsub: introduce pubsub chan Unsub(), fix few sync tests #2109
Conversation
- Introduces Close() to pubsub - adds a Close() test - moves few tests to use pubsub and not read from individual channels Signed-off-by: Eduard Serra <eduser25@gmail.com>
cb94baf
to
b970123
Compare
2a0ac7f
to
a1324a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the use case for Unsub?
Would it make sense to spell out the entire word?
// Unsub is the Unsub implementation for PubSub. | ||
// It is synchronized, upon exit the channel is guaranteed to be both | ||
// unsubbed to all topics and closed. | ||
// This is a necessary step to guarantee garbage collection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At what point in the lifecycle of the controller will this be used? I see that this is needed for garbage collection, but when will it be used, by who, and why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At what point in the lifecycle of the controller will this be used?
None currently. It's a good observation though, none of the pubsub channels are currently freed or released during the lifetime of the controller.
when will it be used, by who, and why?
This will be immediately used by unit tests. If we don't release the channels on the pubsub backend, they are still held and subscribed to the relevant topics accross different unit tests contexts, even when closed from the reader side.
Most of all, I think it's a relevant API to provide. There might be instances/parts of the code that we might have the need to release a certain pubsub resource, and we must be able to do it properly without leaking or leaving stuff on the pubsub backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation! Might be good to drop a comment for clarity. LGTM
Co-authored-by: Delyan Raychev <delyan.raychev@microsoft.com> Signed-off-by: Eduard Serra <eduser25@gmail.com>
4e60267
to
f5fc70c
Compare
Codecov Report
@@ Coverage Diff @@
## main #2109 +/- ##
==========================================
+ Coverage 58.49% 58.51% +0.01%
==========================================
Files 144 144
Lines 5910 5915 +5
==========================================
+ Hits 3457 3461 +4
- Misses 2450 2451 +1
Partials 3 3
Continue to review full report at Codecov.
|
…emesh#2109) * pubsub: introduce close, fix few sync tests - Introduces Close() to pubsub - adds a Close() test - moves few tests to use pubsub and not read from individual channels * CR - naming: Close() -> Unsub() - Add release branch references vs main - use idiomatic channel range to exit on close Signed-off-by: Eduard Serra <eduser25@gmail.com>
fixes #2108
No