MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / nextDelay

Method nextDelay

static/js/utils.js:466–481  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

464 }
465
466 nextDelay(options = {}) {
467 const forceSlow = Boolean(options.forceSlow);
468 let delay = this.baseIntervalMs * this.getConnectionMultiplier();
469 if (!api.networkOnline || forceSlow) {
470 delay = Math.max(delay, this.baseIntervalMs * 2.5);
471 }
472 if (this.failureCount > 0) {
473 delay *= Math.pow(1.55, Math.min(this.failureCount, 5));
474 } else if (this.successCount >= 3) {
475 delay *= 0.88;
476 }
477 delay = Math.max(this.minIntervalMs, Math.min(this.maxIntervalMs, Math.round(delay)));
478 const jitter = Math.round(delay * this.jitterRatio * (Math.random() * 2 - 1));
479 this.lastDelayMs = Math.max(this.minIntervalMs, Math.min(this.maxIntervalMs, delay + jitter));
480 return this.lastDelayMs;
481 }
482}
483
484function createAdaptivePoller(options = {}) {

Callers 1

watchDomainTaskFunction · 0.80

Calls 1

Tested by

no test coverage detected