Skip to content

Commit

Permalink
Remove limit for sockets per connection to fix "Premature close" erro…
Browse files Browse the repository at this point in the history
…r + prepare patch release (#217)

* Remove limit for sockets per connection to fix "Premature close" error

Signed-off-by: Levko Kravets <levko.ne@gmail.com>

* Prepare release 1.7.1 (patch)

Signed-off-by: Levko Kravets <levko.ne@gmail.com>

---------

Signed-off-by: Levko Kravets <levko.ne@gmail.com>
  • Loading branch information
kravets-levko authored Jan 16, 2024
1 parent a86f828 commit c85629b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release History

## 1.7.1

- Fix "Premature close" error which happened due to socket limit when intensively using library
(databricks/databricks-sql-nodejs#217)

## 1.7.0

- Fixed behavior of `maxRows` option of `IOperation.fetchChunk()`. Now it will return chunks
Expand Down
4 changes: 1 addition & 3 deletions lib/connection/connections/HttpConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ export default class HttpConnection implements IConnectionProvider {
private getAgentDefaultOptions(): http.AgentOptions {
const clientConfig = this.context.getConfig();

const cloudFetchExtraSocketsCount = clientConfig.useCloudFetch ? clientConfig.cloudFetchConcurrentDownloads : 0;

return {
keepAlive: true,
maxSockets: 5 + cloudFetchExtraSocketsCount,
keepAliveMsecs: 10000,
maxSockets: Infinity, // no limit
timeout: this.options.socketTimeout ?? clientConfig.socketTimeout,
};
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@databricks/sql",
"version": "1.7.0",
"version": "1.7.1",
"description": "Driver for connection to Databricks SQL via Thrift API.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit c85629b

Please sign in to comment.