-
Notifications
You must be signed in to change notification settings - Fork 90
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
fix: ensure proper cleanup of publisher in tests #310
fix: ensure proper cleanup of publisher in tests #310
Conversation
Adding delivery attempt count to PubsubMessages as a message attribute, and creating helper function to allow users to get the count without knowing implementation details.
lettering is not enabled
Codecov Report
@@ Coverage Diff @@
## master #310 +/- ##
============================================
- Coverage 79.28% 79.21% -0.07%
+ Complexity 319 318 -1
============================================
Files 21 21
Lines 2892 2892
Branches 155 155
============================================
- Hits 2293 2291 -2
- Misses 535 536 +1
- Partials 64 65 +1
Continue to review full report at Codecov.
|
|
||
private void shutdownTestPublisher(Publisher publisher) throws InterruptedException { | ||
publisher.shutdown(); | ||
fakeExecutor.advanceTime(Duration.ofSeconds(10)); |
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.
How was 10 seconds chosen? Specifically, how long does this test need to execute on average?
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.
The gax layer implements a Watchdog (https://github.com/googleapis/gax-java/blob/master/gax/src/main/java/com/google/api/gax/rpc/Watchdog.java) that periodically garbage collects idle streams. The check is scheduled at a fixed rate every 10 seconds. So, I chose 10 seconds to ensure that the watchdog check completes, otherwise we have to wait the full timeout.
Our PublisherImplTest is taking over 5 minutes to run because we are not properly shutting down the publisher/testChannel. This PR ensures everything is shutdown properly, and decreases the test time to 10 seconds. Additional details provided in #309.
Fixes #309 ☕️