Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Return warmup permits in case primary allocation fails #175

Merged
merged 5 commits into from
Sep 12, 2023

Conversation

k-tokarev
Copy link
Contributor

In order to support my issue (#174 (comment)) I made this pull request with test indicating the problem and my "naive" fix for it. Project builds successfully with this fix, so I hope it don't brake anything.

@pivotal-cla
Copy link

@k-tokarev Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@k-tokarev Thank you for signing the Contributor License Agreement!

@k-tokarev
Copy link
Contributor Author

Sorry for imports rearranged in this pull request. My IntelliJ IDEA did it automatically and I don't know how to disable this for one single project.

@pderop pderop self-assigned this Sep 4, 2023
@pderop pderop added this to the 1.0.2 milestone Sep 5, 2023
@pderop
Copy link
Contributor

pderop commented Sep 5, 2023

Hi @k-tokarev ,

Thanks a lot for reporting the issue #174, and for this PR !
I think it is not naive and it seems ok to me, I only have cosmetic comments, and I'll do them in the following review.

Copy link
Contributor

@pderop pderop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are few feedbacks :-)

@reactor/core-team, please take a look ? thanks

@pderop pderop requested a review from a team September 5, 2023 15:19
@k-tokarev
Copy link
Contributor Author

Here are few feedbacks :-)

@reactor/core-team, please take a look ? thanks

I committed all proposed changes. Can you review new version of Pull Request?

Copy link
Contributor

@pderop pderop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good from my POV, but we need @reactor/core-team to also review, maybe they have more comments to do ?

@@ -451,7 +451,7 @@ else if (sig.isOnError()) {
final int mergeConcurrency = Math.min(poolConfig.allocationStrategy().warmupParallelism(), toWarmup + 1);
Flux.range(1, toWarmup)
.map(i -> warmupMono(i, toWarmup, startWarmupIteration, allocator).doOnSuccess(__ -> drain()))
.startWith(primary.doOnSuccess(__ -> drain()).then())
.startWith(primary.doOnSuccess(__ -> drain()).onErrorComplete().then())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As was discussed yesterday, this solves the issue for now but can be further improved to decouple unused permit return from connection acquisition. Right now it is implicit what happens and a reader of the code might scratch their head for some time to understand why this is used.

Copy link
Member

@chemicL chemicL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but hoping for a follow-up refactor to better structure the code and individual operators' responsibilities regarding connection acquisition, error handling, vs permit obtaining and returning to the pool.

@pderop pderop merged commit 9d61d0f into reactor:main Sep 12, 2023
@pderop
Copy link
Contributor

pderop commented Sep 12, 2023

@chemicL , thanks for the review, we'll try to refactor all this in the next version.

@k-tokarev , thanks for the PR, which is merged.

@pderop pderop changed the title Bugfix for issue #174 Return warmup permits in case primary allocation fails Sep 12, 2023
@violetagg violetagg added warn/regression A regression from a previous release type/bug A general bug labels Sep 13, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type/bug A general bug warn/regression A regression from a previous release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants