decord/alpha/source/modules/gateway/AltGatewayTracker.tsx

52 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-10-03 08:58:59 +00:00
// Module ID: 13444
// Function ID: 13445
// Name: AltGatewayTracker
2026-10-03 08:58:59 +00:00
// Dependencies: [13445, 2]
2026-07-20 16:05:17 +00:00
2026-10-03 08:58:59 +00:00
// Module 13444 (AltGatewayTracker)
import react_nativeDefault from "react-native" /* 13445 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
2026-10-03 08:58:59 +00:00
let closure_1 = react_nativeDefault();
const result = size.fileFinishedImporting("modules/gateway/AltGatewayTracker.tsx");
2026-07-29 08:29:29 +00:00
class AltGatewayTracker {
constructor() {
return Object.assign({ failures: 0, fallbackTripped: false });
}
2026-10-03 08:58:59 +00:00
shouldUseAltGateway() {
return !this.fallbackTripped && null != GATEWAY_ALT_ENDPOINT && closure_1;
}
isAssignedToAltGateway() {
return null != GATEWAY_ALT_ENDPOINT && closure_1;
}
getDidFallBack() {
return this.fallbackTripped;
}
getAltGatewayUrl() {
let tmp = null;
if (this.shouldUseAltGateway()) {
tmp = GATEWAY_ALT_ENDPOINT;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
}
recordSuccess() {
this.failures = 0;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
recordFailure() {
const self = this;
if (this.shouldUseAltGateway()) {
self.failures = self.failures + 1;
if (self.failures >= 3) {
self.fallbackTripped = true;
}
}
}
reset() {
this.failures = 0;
this.fallbackTripped = false;
}
}
const prototype = AltGatewayTracker.prototype;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default AltGatewayTracker;