Skip to content

Commit

Permalink
Fix Nodejs v16 regression due to nodejs/node#38924
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Oct 11, 2021
1 parent ec91485 commit e1cba8d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/server/http/router/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,8 @@ export class KibanaRequest<
}

private getEvents(request: Request): KibanaRequestEvents {
const finish$ = merge(
fromEvent(request.raw.res, 'finish'), // Response has been sent
fromEvent(request.raw.req, 'close') // connection was closed
).pipe(shareReplay(1), first());
// the response is completed, or its underlying connection was terminated prematurely
const finish$ = fromEvent(request.raw.res, 'close').pipe(shareReplay(1), first());

const aborted$ = fromEvent<void>(request.raw.req, 'aborted').pipe(first(), takeUntil(finish$));
const completed$ = merge<void, void>(finish$, aborted$).pipe(shareReplay(1), first());
Expand Down

0 comments on commit e1cba8d

Please sign in to comment.