cancel active query doesn't work with js bindings
See original GitHub issueCancelling long running query, doesn’t work with js bindings, though with native bindings it works. Example:
pg = require('pg');
var client = new pg.Client(...);
client.on('notice', function(msg) {
console.log("custom notice: " + msg);
});
client.connect(function(err){
if (err){
console.log(err);
}
var query_text = "select pg_sleep(20);";
var query = client.query(query_text, function(err, result){
if (err){
console.log(err);
}
});
console.log("wating for 5 seconds");
setInterval(function(){
console.log("canceling query");
client.cancel(query);
}, 5000);
});
After issuing cancel the query keeps running, while with native bindings it returns error as expected:
wating for 5 seconds
canceling query
{ [Error: ERROR: canceling statement due to user request
]
severity: 'ERROR',
sqlState: '57014',
messagePrimary: 'canceling statement due to user request',
sourceFile: 'postgres.c',
sourceLine: '3009',
sourceFunction: 'ProcessInterrupts' }
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Promise with query binding doesnt end - Stack Overflow
I having this function query in my module mysqlFunction in NodeJs. The functions work without a problem when the query hasn't had binding,...
Read more >The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >Stop using Knex.js. Using SQL query builder is an…
To solve this problem, you first need to answer “What query do I need to execute to get this result?” You might even...
Read more >Don't Block the Event Loop (or the Worker Pool) - Node.js
If a thread is taking a long time to execute a callback (Event Loop) or a task (Worker), we call it "blocked". While...
Read more >bq command-line tool reference | BigQuery - Google Cloud
This flag applies only to commands that create jobs: cp , extract , load , and query . If you don't use the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Does it still doesn’t work? 🎱
Looks like #1392 has stalled. Is this on the roadmap? I’m also not sure how you’d implement the above using
await
via the promises API since your code wouldn’t reach thesetTimeout
bit. Any thoughts @boromisp?