start of performance

This commit is contained in:
tresabhi committed 2026-08-11 20:03:57 -05:00
1 parent 08c909fbe2
commit b3e439669b
11 files changed
+64 -87

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import { API_RATE } from "./constants";
const MAX_COMPUTE_TIME = (5 * 60 + 55) * 60 * 1000; // 5hr 55min
const t0 = performance.now();
const t1 = t0 + MAX_COMPUTE_TIME;
export function withinTimeLimit() {
return performance.now() < t1;
}
export function sleep() {
return new Promise((resolve) => setTimeout(resolve, 1000 / API_RATE));
}