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
Connection is closed with Promise.all #398
Comments
I receive this error as well. I only have two requests in my Promise.all but it throws an error saying the connection is closed. This is for a web server but this is my code:
But it throws this error:
|
My problem was fixed with #138 (comment) |
@jmartinez-jobsity I do pass the connection object into the Request constructor, as #138 (comment) suggests. I can't do function _connectToDatabase(execute) {
return new Promise((resolve, reject) => {
connectionManager.getDatabaseConnection()
.then(connection => (new sql.Request(connection)))
.then(execute)
.then(resolve)
.catch(error => reject(_sqlErrorParser(error)));
});
} |
Weird, cause we are also using Promise.all with a similar approach and it is working |
@jmartinez-jobsity |
closing as outdated |
I'm finding rampant "Connection is Closed" errors when attempting to paralellize multiple requests using the native
Promise.all
.For example if I try to run 4 queries in parallel to
SELECT
from the same table, the first Request in thePromise.all
reports the error.If I try to run 4
INSERT
s requests in parallel into the same table (yes I'm familiar withbulk
), the firstRequest
in thePromise.all
array reports the error, but the last Request succeeds with insertion (as verified by direct SQL calls to the server).I believe this bug is related to the Tedious Bug.
The text was updated successfully, but these errors were encountered: