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

Drain the response stream in the command method #264

Merged
merged 8 commits into from May 8, 2024
Merged

Conversation

slvrtrn
Copy link
Contributor

@slvrtrn slvrtrn commented May 7, 2024

Summary

The command method now drains the response stream properly, as the previous implementation could cause the Keep-Alive socket to close after each request.

Checklist

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG

if (!params.body) return request.end()
})
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The buildDefaultHeaders/createClientRequest/request methods were moved to the bottom cause it was too annoying to have it at the very top (no other changes).

} finally {
controllerCleanup()
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one was used for both exec + command client methods. Now, the connection has them separate, but the logic is still (mostly) shared.

@@ -18,5 +18,4 @@ export const WebImpl: ImplementationDetails<ReadableStream>['impl'] = {
query_id: string,
) => new ResultSet(stream, format, query_id)) as any,
values_encoder: new WebValuesEncoder(),
close_stream: (stream) => stream.cancel(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Finally, we don't need this anymore.

@slvrtrn slvrtrn requested a review from mshustov May 7, 2024 12:24
Copy link

sonarcloud bot commented May 7, 2024

@slvrtrn slvrtrn merged commit ddcc741 into main May 8, 2024
@slvrtrn slvrtrn deleted the update-command-impl branch May 8, 2024 13:25
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.

None yet

2 participants