Skip to content

Commit 7507138

Browse files
committed
Fix uncaught error issue
1 parent 01853ee commit 7507138

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/client.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,20 +377,22 @@ Client.prototype.query = function (config, values, callback) {
377377
queryCallback = query.callback;
378378

379379
readTimeoutTimer = setTimeout(() => {
380-
var error = new Error('Query read timeout');
380+
var error = new Error('Query read timeout')
381381

382382
this.emit('error', error)
383383
queryCallback(error)
384384

385385
// we already returned an error,
386-
// just do nothing when query completes
387-
delete query.callback
386+
// just do nothing if query completes
387+
query.callback = () => {}
388388

389389
// Remove from queue
390390
var index = this.queryQueue.indexOf(query)
391391
if (index > -1) {
392392
this.queryQueue.splice(index, 1)
393393
}
394+
395+
this._pulseQueryQueue()
394396
}, readTimeout)
395397

396398
query.callback = (err, res) => {

0 commit comments

Comments
 (0)