-
Notifications
You must be signed in to change notification settings - Fork 10
MantisMasterClientApi: Added connection caching for discovery informa… #28
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
base: master
Are you sure you want to change the base?
Conversation
…tion and status information.
| .onErrorResumeNext(Observable.empty()) | ||
| .doOnCompleted(() -> { | ||
| logger.info("Purging {} from job status cache", id); | ||
| jobSchedulingInfoCache.remove(id); |
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.
@codyrioux This change will affect mantisclient and hence all jobs as well. Should we move the caching up a layer to reduce potential impact?
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.
Up a layer as in directly inside Mantis API?
If so, already implemented. I thought we might want to do it here because multiple connections to jobs via the Mantis API (if they use different query params) will still cause multiple subscriptions to scheduling info.
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.
I see, yah in that case we could make this optional and default it to false, and then only enable it on mantis api first and then slowly roll out to jobs perhaps?
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.
yeah, given the blast radius, +1 for putting this behind a property so it can be disabled at runtime if we see any issues
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.
+1 on rollout. should we also add a unit test to test this behavior?
| logger.info("Purging {} from job status cache", id); | ||
| jobSchedulingInfoCache.remove(id); | ||
| }) | ||
| .replay(25) |
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.
missing a doOnError to clear the cache? Wonder if that is causing the log line to not get printed in your testing.
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.
Interestingly the cache is evicted immediately with the new doOnError, but still no error message logged.
| .retryWhen(retryLogic) | ||
| ; | ||
| .doOnCompleted(() -> { | ||
| logger.info("Purging {} from job scheudling info cache", id); |
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.
typo: scheudling -> scheduling
98d8eaf to
84eefa3
Compare
| logger.info("Purging {} from job status cache", id); | ||
| jobSchedulingInfoCache.remove(id); | ||
| }) | ||
| .doOnError((t) -> { |
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.
noticed the onErrorResumeNext() up this observable chain, so this doOnError will not get executed, it should probably be before the onErrorResumeNext
Information and status
Added caching similar to MantisAPI to reduce the overall connections any one client maintains to Mantis Master.
Note: I'm not seeing the "Purging jobId from job scheduling info cache" messages for whatever reason but it does appear to be correctly reusing the connection. This is evident as additional incoming connections do not showing additional "Caching scheduling change observable for jobId." log line. Furthermore if all connections are closed and then another re-opened we do see the "Caching scheduling change observable for jobId."
I have the release candidate built off this pulled into a local
mantis-apibuild which has its own connection re-use turned off. Everything is operating as expected.Context
This pull request causes the client to re-use existing scheduling information and status update streams from the master thus reducing the overall load on Mantis Master.
Checklist
./gradlew buildcompiles code correctly./gradlew testpasses all testsCONTRIBUTING.md