const assertz = () => { const timer = new Date().getTime(); const minTime = ((opts.max * (opts.max + 1)) / 2) * opts.backoff; counter.should.equal(opts.max); timer.should.be.at.least(minTime);
setTimeout(function(){ if (self.skipReconnect) return; debug('attempting reconnect'); self.emitAll('reconnect_attempt', self.backoff.attempts); self.emitAll('reconnecting', self.backoff.attempts); // check again for the case socket closed in above events if (self.skipReconnect) return; self.open(function(err){ if (err) { debug('reconnect attempt error'); self.reconnecting = false; self.reconnect(); self.emitAll('reconnect_error', err.data); } else { debug('reconnect success'); self.onreconnect(); } }); }, delay)
recovery.backoff(function backedoff(err, opts) { opts.duration = (+new Date()) - opts.start; if (err) return recovery.emit('reconnect failed', err, opts); recovery.emit('reconnected', opts); }, recovery.attempt)
_onDataReceived(data?: any) { // Nylas sends a newline heartbeat in the raw data stream once every 5 seconds. // Automatically restart the connection if we haven't gotten any data in // Delta.streamingTimeoutMs. The connection will restart with the last // received cursor. clearTimeout(this.timeoutId); this.restartBackoff.reset(); this.timeoutId = setTimeout( this.restartBackoff.backoff.bind(this.restartBackoff), Delta.streamingTimeoutMs ) as any; }
// cancel scheduled fetch retries of Split, Segment, and MySegment Update Workers function stopWorkers() { workers.forEach(worker => worker.backoff.reset()); }
this.q.create(name, data) .priority(options.priority || 'normal') .removeOnComplete(options.removeOnComplete || false) .attempts(options.attempts) .ttl((options.ttl ? options.ttl + this.ttl_buffer : 10000 + this.ttl_buffer )) // 10s .backoff(options.backoff) .delay(options.delay) .save(function(err){ debug('Add job ' + job.type + '(' + job.id + ') ' + JSON.stringify(data)) fn && fn(err) })
setTimeout(function () { t.skipReconnect || (h("attempting reconnect"), t.emitAll("reconnect_attempt", t.backoff.attempts), t.emitAll("reconnecting", t.backoff.attempts), t.skipReconnect || t.open(function (e) { e ? (h("reconnect attempt error"), t.reconnecting = !1, t.reconnect(), t.emitAll("reconnect_error", e.data)) : (h("reconnect success"), t.onreconnect()) })) }, e)
recovery.backoff(function backedoff(err, opts) { opts.duration = (+new Date()) - opts.start; if (err) return recovery.emit('reconnect failed', err, opts); recovery.emit('reconnected', opts); }, recovery.attempt)
recovery.backoff(function backedoff(err, opts) { opts.duration = (+new Date()) - opts.start; if (err) return recovery.emit('reconnect failed', err, opts); recovery.emit('reconnected', opts); }, recovery.attempt)
recovery.backoff(function backedoff(err, opts) { opts.duration = (+new Date()) - opts.start; if (err) return recovery.emit('reconnect failed', err, opts); recovery.emit('reconnected', opts); }, recovery.attempt)
recovery.backoff(function backedoff(err, opts) { opts.duration = (+new Date()) - opts.start; if (err) return recovery.emit('reconnect failed', err, opts); recovery.emit('reconnected', opts); }, recovery.attempt)
recovery.backoff(function backedoff(err, opts) { opts.duration = (+new Date()) - opts.start; if (err) return recovery.emit('reconnect failed', err, opts); recovery.emit('reconnected', opts); }, recovery.attempt)