mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-24 08:54:05 +10:00
chore: lint using react-doctor, update translations, dynamic imports
This commit is contained in:
@@ -75,17 +75,28 @@ export async function* subscribeResumeUpdated({ resumeId, userId, signal }: Subs
|
||||
try {
|
||||
await client.query(`LISTEN ${RESUME_UPDATED_CHANNEL}`);
|
||||
|
||||
while (!done) {
|
||||
const waitForNextEvent = async (): Promise<ResumeUpdatedEvent | null> => {
|
||||
if (done) return null;
|
||||
|
||||
const event = queue.shift();
|
||||
if (event) {
|
||||
yield event;
|
||||
continue;
|
||||
}
|
||||
if (event) return event;
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
wake = resolve;
|
||||
});
|
||||
|
||||
return waitForNextEvent();
|
||||
};
|
||||
|
||||
async function* streamEvents(): AsyncGenerator<ResumeUpdatedEvent> {
|
||||
const event = await waitForNextEvent();
|
||||
if (!event) return;
|
||||
|
||||
yield event;
|
||||
yield* streamEvents();
|
||||
}
|
||||
|
||||
yield* streamEvents();
|
||||
} finally {
|
||||
signal?.removeEventListener("abort", onAbort);
|
||||
client.off("notification", onNotification);
|
||||
|
||||
Reference in New Issue
Block a user