The current implementation simply leaves the backend to hang.
|
if (readTimeout) { |
|
queryCallback = query.callback |
|
|
|
readTimeoutTimer = setTimeout(() => { |
|
var error = new Error('Query read timeout') |
|
|
|
process.nextTick(() => { |
|
query.handleError(error, this.connection) |
|
}) |
|
|
|
queryCallback(error) |
|
|
|
// we already returned an error, |
|
// just do nothing if query completes |
|
query.callback = () => {} |
|
|
|
// Remove from queue |
|
var index = this.queryQueue.indexOf(query) |
|
if (index > -1) { |
|
this.queryQueue.splice(index, 1) |
|
} |
|
|
|
this._pulseQueryQueue() |
|
}, readTimeout) |
|
|
|
query.callback = (err, res) => { |
|
clearTimeout(readTimeoutTimer) |
|
queryCallback(err, res) |
|
} |
|
} |
This seems dangerous. A better solution would seem to be to issue pg_cancel_backend when client timeout is reached.
The current implementation simply leaves the backend to hang.
node-postgres/lib/client.js
Lines 480 to 509 in 60d8df6
This seems dangerous. A better solution would seem to be to issue
pg_cancel_backendwhen client timeout is reached.