diff --git a/lib/io.js b/lib/io.js index 928a97b..e5d5441 100644 --- a/lib/io.js +++ b/lib/io.js @@ -26,7 +26,7 @@ module.exports = class IO { this.ontimeout = ontimeout this._pending = new FIFO() - this._rotateSecrets = 8 + this._rotateSecrets = 10 this._tid = (Math.random() * 65536) | 0 this._secrets = null this._drainInterval = null @@ -65,6 +65,8 @@ module.exports = class IO { if (i === this.inflight.length - 1) this.inflight.pop() else this.inflight[i] = this.inflight.pop() + // TODO: Auto retry here if BAD_TOKEN is returned? + if (req._timeout) { clearTimeout(req._timeout) req._timeout = null @@ -161,7 +163,7 @@ module.exports = class IO { _drain () { if (this._secrets !== null && --this._rotateSecrets === 0) { - this._rotateSecrets = 8 + this._rotateSecrets = 10 const tmp = this._secrets[0] this._secrets[0] = this._secrets[1] this._secrets[1] = tmp @@ -237,7 +239,7 @@ class Request { } error (code, opts = {}) { - this.sendReply(code, null, false, this.target !== null && opts.closerNodes !== false) + this.sendReply(code, null, opts.token === true, this.target !== null && opts.closerNodes !== false) } send (force = false) {