decord/source/modules/gateway/AltGatewayTracker.tsx

56 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13111
// Function ID: 13112
2026-07-29 08:29:29 +00:00
// Name: shouldUseAltGateway
2026-08-25 06:04:03 +00:00
// Dependencies: [13112, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 13111 (shouldUseAltGateway)
import getCachedUseAltGatewayDefault from "getCachedUseAltGateway" /* 13112 */;
2026-08-24 06:08:38 +00:00
let closure_1 = getCachedUseAltGatewayDefault();
2026-07-29 08:29:29 +00:00
const result = require("set").fileFinishedImporting("modules/gateway/AltGatewayTracker.tsx");
class AltGatewayTracker {
}
const prototype = AltGatewayTracker.prototype;
prototype["shouldUseAltGateway"] = function shouldUseAltGateway(arg0) {
const fallbackTripped = this.fallbackTripped;
let tmp = !fallbackTripped;
if (!fallbackTripped) {
tmp = null != GATEWAY_ALT_ENDPOINT;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
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;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
};
prototype["reset"] = function reset() {
this.failures = 0;
this.fallbackTripped = false;
};
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default AltGatewayTracker;