refactor: sendtime/join time

This commit is contained in:
手瓜一十雪 committed 2024-07-25 10:32:44 +08:00
1 parent 3bb349e20a
commit 85b176ab79
4 files changed
+51 -23

No files matched your search

+1 -2
View File
@@ -18,9 +18,8 @@ export function PromiseTimer<T>(promise: Promise<T>, ms: number): Promise<T> {
);
return Promise.race([promise, timeoutPromise]);
}
export async function runAllWithTimeout<T>(tasks: Promise<T>[], timeout: number): Promise<T[]> {
const wrappedTasks = tasks.map(task =>
const wrappedTasks = tasks.map(task =>
PromiseTimer(task, timeout).then(
result => ({ status: 'fulfilled', value: result }),
error => ({ status: 'rejected', reason: error })