-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -848,8 +848,9 @@ export function makeServer< | |
// wait for close, cleanup and the disconnect callback | ||
return async (code, reason) => { | ||
if (connectionInitWait) clearTimeout(connectionInitWait); | ||
for (const sub of Object.values(ctx.subscriptions)) { | ||
for (const [id, sub] of Object.entries(ctx.subscriptions)) { | ||
if (isAsyncGenerator(sub)) await sub.return(undefined); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
enisdenjo
Author
Owner
|
||
delete ctx.subscriptions[id]; // deleting the subscription means no further activity should take place | ||
} | ||
if (ctx.acknowledged) await onDisconnect?.(ctx, code, reason); | ||
await onClose?.(ctx, code, reason); | ||
|
While awaiting for
sub.return
here, other pending subscription requests can complete without them having been removed first. That would still lead to orphan subscriptions. Also,operationResult.return(undefined)
should be awaited (line 810).