You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: Implement pause/resume for request streams #89
I'm helping to maintain node-mssql and the tedious driver has recently added pause/resume functions to their requests which has allowed us to pass this functionality on.
Pausing and resuming request streams is very useful when dealing with extremely large datasets as it allows the application to back-off when processing of rows can't keep up with the speed they are returned (usually resulting in out of memory errors).
Ideally I'd like to implement true node streams in node-mssql but I can't do this without the sqlserver-v8 driver providing this back-off functionality.
Well the code is currently structured to work it’s way through one query at a time so it depends on required functionality. To pause and resume the current running query would not be too bad but for example to have two active side by side queries where each can pause and resume independently would be a huge refactor and one i don’t really have time for currently.
So I guess it all depends on what is needed
On 7 Jan 2019, at 10:24, Daniel Hensby ***@***.***> wrote:
I'm helping to maintain node-mssql and the tedious driver has recently added pause/resume functions to their requests which has allowed us to pass this functionality on.
Pausing and resuming request streams is very useful when dealing with extremely large datasets as it allows the application to back-off when processing of rows can't keep up with the speed they are returned (usually resulting in out of memory errors).
Ideally I'd like to implement true node streams in node-mssql but I can't do this without the sqlserver-v8 driver providing this back-off functionality.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
Sorry for delay on this. From our point of view we just need to be able to reliably apply backpressure to a stream (ie: pause and resume it on demand). I'm not too bothered about concurrency (though that would be nice).
test('pause a large query every 100 rows',testDone=>{letexpected=0constq0=theConnection.query(`select * from syscolumns`)q0.on('row',()=>{++expected})letrows=0constq=theConnection.query(`select * from syscolumns`)q.on('error',(e)=>{assert.ifError(e)})q.on('row',()=>{++rowsif(rows%100===0){q.pauseQuery()setTimeout(()=>{q.resumeQuery()},200)}})q.on('done',()=>{assert.strictEqual(expected,rows)testDone()})})
Thanks for this @TimelordUK - I've opened a PR to add the pause/resume feature to our v8 adapter. However it seems to be failing in our appveyor builds for node v6 and v8 (v10 is running, at least).
I have had request to potentially add older node back unfortunately the cpp itself will not compile against old and new post 10 node without basically compiler switches based on version which is why I wanted to drop it.
On 31 May 2019, at 13:48, Daniel Hensby ***@***.***> wrote:
Ah - I just noticed in v0.7.1 you dropped node <10 support. The package.json for this lib needs updating, then.
—I’ll
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.il
Activity
TimelordUK commentedon Jan 8, 2019
dhensby commentedon Mar 8, 2019
Sorry for delay on this. From our point of view we just need to be able to reliably apply backpressure to a stream (ie: pause and resume it on demand). I'm not too bothered about concurrency (though that would be nice).
TimelordUK commentedon May 26, 2019
this should be available in 0.7.2
dhensby commentedon May 31, 2019
Thanks for this @TimelordUK - I've opened a PR to add the pause/resume feature to our v8 adapter. However it seems to be failing in our appveyor builds for node v6 and v8 (v10 is running, at least).
Any ideas what the difference would be?
dhensby commentedon May 31, 2019
Ah - I just noticed in v0.7.1 you dropped node <10 support. The
package.jsonfor this lib needs updating, then.TimelordUK commentedon May 31, 2019
dhensby commentedon Aug 7, 2019
This is now done 🎉