mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-12 04:19:25 -07:00
29 lines
764 B
TypeScript
29 lines
764 B
TypeScript
const DEFAULT_AUTOPLAY_RELEASE_RETRY_DELAY_MS = 200;
|
|
const STARTUP_AUTOPLAY_RELEASE_TIMEOUT_MS = 15_000;
|
|
|
|
export function resolveAutoplayReadyMaxReleaseAttempts(options?: {
|
|
forceWhilePaused?: boolean;
|
|
retryDelayMs?: number;
|
|
startupTimeoutMs?: number;
|
|
}): number {
|
|
if (options?.forceWhilePaused !== true) {
|
|
return 3;
|
|
}
|
|
|
|
const retryDelayMs = Math.max(
|
|
1,
|
|
Math.floor(options.retryDelayMs ?? DEFAULT_AUTOPLAY_RELEASE_RETRY_DELAY_MS),
|
|
);
|
|
const startupTimeoutMs = Math.max(
|
|
retryDelayMs,
|
|
Math.floor(options.startupTimeoutMs ?? STARTUP_AUTOPLAY_RELEASE_TIMEOUT_MS),
|
|
);
|
|
|
|
return Math.max(3, Math.ceil(startupTimeoutMs / retryDelayMs));
|
|
}
|
|
|
|
export {
|
|
DEFAULT_AUTOPLAY_RELEASE_RETRY_DELAY_MS,
|
|
STARTUP_AUTOPLAY_RELEASE_TIMEOUT_MS,
|
|
};
|