fix: closes pool maintainer on invalidation - #784
Conversation
When the session pool is marked as invalid, we immediately close the pool maintainer in order to keep it from trying to replinish the pool. This way we prevent useless batch create sessions requests.
|
This fixes the following problem
|
Codecov Report
@@ Coverage Diff @@
## master #784 +/- ##
============================================
+ Coverage 85.01% 85.06% +0.05%
- Complexity 2561 2564 +3
============================================
Files 143 143
Lines 14005 14037 +32
Branches 1337 1344 +7
============================================
+ Hits 11906 11941 +35
+ Misses 1537 1533 -4
- Partials 562 563 +1 Continue to review full report at Codecov.
|
|
@thiagotnunes I just thought of one small catch with this:
The above is probably also the reason that a number of the tests were cancelled, because they never finished (still waiting for the session pool to close). The solution would be to only conditionally do +1 in step 2 above for the pool maintainer. If it has already been closed because the session pool is invalid, then we should not wait for it to close. |
olavloite
left a comment
There was a problem hiding this comment.
(Sorry for the flip-flopping, see my previous comment)
|
@olavloite Thanks for spotting this, will work on the fix. |
When closing the pool, only waits for the pool maintainer to close if it has not been closed before.
Makes sure to close the pool maintainer only if it has not been closed already. Also before returning to the caller, makes sure to mark the closing as complete if there are no pending closures.
|
@olavloite Fixed the implementation, now we only close the |
|
Some tests seem to be getting stuck eventually, I think I introduced a bug somewhere. Will mark it as do not merge until I had the time to investigate. |
Verifies that the pool maintainer is not closed before closing it. Also moves the check of pendingClosures into the synchronized block to make sure no stale reads are made.
When the session pool is marked as invalid, we immediately close the pool maintainer in order to keep it from trying to replenish the pool. This way we prevent useless batch create sessions requests.
Fixes #768