mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-12 04:19:25 -07:00
feat(stats): add v1 immersion stats dashboard (#19)
This commit is contained in:
28
src/main/runtime/startup-autoplay-release-policy.ts
Normal file
28
src/main/runtime/startup-autoplay-release-policy.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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,
|
||||
};
|
||||
Reference in New Issue
Block a user