-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure there is only 1 subscription in PushTrigger #238
Conversation
|
||
)); | ||
// decouple from calling thread | ||
.observeOn(Schedulers.computation()) |
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.
Thoughts on computation scheduler vs IO scheduler for this task?
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.
Actually I wonder why we need to specify a schedule at all. It can just run on whatever scheduler it's already running on. @hmitnflx do you know? Maybe I can just remove this line.
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.
LGTM!
subscriptionActive.decrement(); | ||
}) | ||
.subscribe((T data) -> queue.write(data) | ||
, |
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.
nit: move this to the previous line?
* Ensure there is only 1 subscription * clean up some formatting * fix scheduler Co-authored-by: Calvin Cheung <ccheung@netflix.com>
Context
There is an implicit assumption that subscription should be 1. Before, the subscriptionActive gauge is always set to 1 whenever there is at least 1 subscription. I change that to increment/decrement on subscribe/unsubscribe to more accurately reflect the number of subscriptions. Before, the unsubscribe was purposely commented out. Clearly, this can lead to multiple subscription, which violates the assumption. With this change, we will unsubscribe the old subscription when a new subscription is created. This should correct keep active subscription at 1.
Checklist
./gradlew build
compiles code correctly./gradlew test
passes all testsCONTRIBUTING.md