@everworker/oneringai 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -994,6 +994,12 @@ var StorageRegistry = class _StorageRegistry {
994
994
  _StorageRegistry.entries.set(key, value);
995
995
  return value;
996
996
  }
997
+ /**
998
+ * Remove a single storage backend.
999
+ */
1000
+ static remove(key) {
1001
+ return _StorageRegistry.entries.delete(key);
1002
+ }
997
1003
  /**
998
1004
  * Check if a storage backend has been configured.
999
1005
  */
@@ -1156,12 +1162,16 @@ var CircuitBreaker = class extends EventEmitter {
1156
1162
  }
1157
1163
  }
1158
1164
  /**
1159
- * Remove failures outside the time window
1165
+ * Remove failures outside the time window and cap array size
1160
1166
  */
1161
1167
  pruneOldFailures() {
1162
1168
  const now = Date.now();
1163
1169
  const cutoff = now - this.config.windowMs;
1164
1170
  this.failures = this.failures.filter((f) => f.timestamp > cutoff);
1171
+ const maxFailures = Math.max(this.config.failureThreshold * 2, 20);
1172
+ if (this.failures.length > maxFailures) {
1173
+ this.failures = this.failures.slice(-maxFailures);
1174
+ }
1165
1175
  }
1166
1176
  /**
1167
1177
  * Get current state