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 number of threads for Node.js API #1918

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/nodejs_api/src_js/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ class Connection {
* function on the returned object.
*
* @param {kuzu.Database} database the database object to connect to.
* @param {Number} numThreads the maximum number of threads to use for query execution.
*/
constructor(database) {
constructor(database, numThreads = null) {
if (
typeof database !== "object" ||
database.constructor.name !== "Database"
Expand All @@ -29,6 +30,10 @@ class Connection {
this._connection = null;
this._isInitialized = false;
this._initPromise = null;
numThreads = parseInt(numThreads);
if (numThreads && numThreads > 0) {
this._numThreads = numThreads;
}
}

/**
Expand All @@ -50,7 +55,6 @@ class Connection {
this._isInitialized = true;
if (this._numThreads) {
this._connection.setMaxNumThreadForExec(this._numThreads);
delete this._numThreads;
}
resolve();
}
Expand Down
Loading