decord/stable/source/modules/gateway/AltGatewayTracker.tsx
github-actions 57c2214117 chore: update source for stable 347.12
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-29 21:26:22 +00:00

59 lines
1.6 KiB
TypeScript

// Module ID: 13929
// Function ID: 13930
// Name: AltGatewayTracker
// Dependencies: [13930, 2]
// Module 13929 (AltGatewayTracker)
import getCachedUseAltGatewayDefault from "getCachedUseAltGateway" /* 13930 */;
let closure_1 = getCachedUseAltGatewayDefault();
const size = fn(2);
const result = size.fileFinishedImporting("modules/gateway/AltGatewayTracker.tsx");
class AltGatewayTracker {
constructor() {
return Object.assign({ failures: 0, fallbackTripped: false });
}
}
const prototype = AltGatewayTracker.prototype;
prototype["shouldUseAltGateway"] = function shouldUseAltGateway() {
const fallbackTripped = this.fallbackTripped;
let tmp = !fallbackTripped;
if (!fallbackTripped) {
tmp = null != GATEWAY_ALT_ENDPOINT;
}
if (tmp) {
tmp = closure_1;
}
return tmp;
};
prototype["isAssignedToAltGateway"] = function isAssignedToAltGateway() {
return null != GATEWAY_ALT_ENDPOINT && closure_1;
};
prototype["getDidFallBack"] = function getDidFallBack() {
return this.fallbackTripped;
};
prototype["getAltGatewayUrl"] = function getAltGatewayUrl() {
let tmp = null;
if (this.shouldUseAltGateway()) {
tmp = GATEWAY_ALT_ENDPOINT;
}
return tmp;
};
prototype["recordSuccess"] = function recordSuccess() {
this.failures = 0;
};
prototype["recordFailure"] = function recordFailure() {
const self = this;
if (this.shouldUseAltGateway()) {
self.failures = self.failures + 1;
if (self.failures >= 3) {
self.fallbackTripped = true;
}
}
};
prototype["reset"] = function reset() {
this.failures = 0;
this.fallbackTripped = false;
};
export default AltGatewayTracker;