mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
start of performance
This commit is contained in:
1 parent
08c909fbe2
commit
b3e439669b
11 files changed
+64
-87
No files matched your search
@@ -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));
|
||||
}
|
||||
Reference in new issue
Block a user