Skip to content

Commit 57ae111

Browse files
alexfriesenalan-agius4
authored andcommitted
refactor(@angular/ssr): drain node stream
1 parent 6e013b7 commit 57ae111

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/angular/ssr/node/src/response.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ export async function writeResponseToNodeResponse(
7171
break;
7272
}
7373

74-
(destination as ServerResponse).write(value);
74+
const canContinue = (destination as ServerResponse).write(value);
75+
if (!canContinue) {
76+
await new Promise<void>((resolve) => destination.once('drain', resolve));
77+
}
7578
}
7679
} catch {
7780
destination.end('Internal server error.');

0 commit comments

Comments
 (0)