Skip to content

Commit

Permalink
Remove the response close event as an indicator of the requesting f…
Browse files Browse the repository at this point in the history
…inishing

opensearch-project#3601 (comment)

Signed-off-by: Miki <miki@amazon.com>
Co-authored-by: Anan Zhuang <ananzh@amazon.com>
  • Loading branch information
AMoo-Miki and ananzh committed May 20, 2023
1 parent c6f1bda commit 72fafe0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/core/server/http/router/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,7 @@ export class OpenSearchDashboardsRequest<
}

private getEvents(request: Request): OpenSearchDashboardsRequestEvents {
const finish$ = merge(
fromEvent(request.raw.res, 'finish'), // Response has been sent
fromEvent(request.raw.req, 'close') // connection was closed
).pipe(shareReplay(1), first());

const finish$ = fromEvent(request.raw.res, 'finish').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 72fafe0

Please sign in to comment.