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(server): count http calls in connection guard #1468

Merged
merged 5 commits into from
Oct 7, 2024
Merged

Conversation

niklasad1
Copy link
Member

Close #1467

The ConnectionGuard was dropped before actually waiting for the http future to resolved which this fixes by enforcing RpcService to take ownership of ConnectionState.

Comment on lines 1157 to 1159
let rp = http::response::denied();
drop(conn);
Box::pin(async { Ok(rp) })
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this is just a tidy up and isn't changing any semantics right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yupp, it was to make it more verbose that it wasn't any async code but I can revert it if you want.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment for this instead. I'm not super happy with the drop stuff here because it's easy to mess up but fine for now.

let rp =
http::call_with_service(request, batch_config, max_request_size, rpc_service, max_response_size)
.await;
drop(conn);
Copy link
Collaborator

Choose a reason for hiding this comment

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

And this is the main bit; droping here to pull it into the async function after the await.

Perhaps worth a comment to make clear we are dropping it for this reaosn?

@niklasad1 niklasad1 merged commit 7ad8079 into master Oct 7, 2024
11 checks passed
@niklasad1 niklasad1 deleted the na-fix-1467 branch October 7, 2024 12:21
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.

ConnectionState dropped before HTTP request is finished
4 participants