review feedback

This commit is contained in:
mertalev
2026-05-07 18:33:23 -04:00
parent 4ec06aaa38
commit 1b8a5f3307
3 changed files with 9 additions and 3 deletions
+4 -1
View File
@@ -2,8 +2,11 @@ import { ArgOf, EmitEvent } from 'src/repositories/event.repository';
export class PendingEvents<T extends { [T in EmitEvent]: ArgOf<T> extends { error?: string } ? T : never }[EmitEvent]> {
private pending = new Map<string, { completers: PromiseWithResolvers<ArgOf<T>>[]; timeout: NodeJS.Timeout }>();
private timeoutMs: number;
constructor(private timeoutMs: number) {}
constructor({ timeoutMs }: { timeoutMs: number }) {
this.timeoutMs = timeoutMs;
}
wait(key: string): Promise<ArgOf<T>> {
const completer = Promise.withResolvers<ArgOf<T>>();