Skip to content
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: Ensures response end handler is invoked just once #8849

Merged
merged 2 commits into from
Mar 8, 2022

Conversation

AlanConfluent
Copy link
Member

Description

On http2, when a client connection is closed, the response end handler is called twice, so this prevents that. The metrics were getting double counted as a result.

Testing done

Wrote unit test and tested manually.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@AlanConfluent AlanConfluent requested a review from a team as a code owner March 4, 2022 20:14
@@ -219,6 +233,10 @@ private void handleQueryPublisher(

// When response is complete, publisher should be closed and query unregistered
routingContext.response().endHandler(v -> {
if (endedResponse.getAndSet(true)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

super nit: let's extract this into a close(Closeable item) method that gets and sets, closes the underlying item and reports the metrics?

@AlanConfluent AlanConfluent merged commit a2efcc5 into confluentinc:master Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants