Skip to content

Commit

Permalink
fix: destroy request in case of error (#1107)
Browse files Browse the repository at this point in the history
* fix: destroy request in case of error

Signed-off-by: Anatolii Bazko <abazko@redhat.com>

* fixup

Signed-off-by: Anatolii Bazko <abazko@redhat.com>

---------

Signed-off-by: Anatolii Bazko <abazko@redhat.com>
  • Loading branch information
tolusha committed May 13, 2024
1 parent 0125fb5 commit 9834cd4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export class DevWorkspaceApiService implements IDevWorkspaceApi {
},
(error: unknown) => {
logger.warn(error, `Stopped watching ${path}.`);
request.destroy();
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export class EventApiService implements IEventApi {
queryParams,
(eventPhase: string, apiObj: CoreV1Event | V1Status) =>
this.handleWatchMessage(eventPhase, apiObj, listener, params),
(error: unknown) => this.handleWatchError(error, path),
(error: unknown) => {
this.handleWatchError(error, path);
request.destroy();
},
);

this.stopWatch = () => request.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ export class PodApiService implements IPodApi {
queryParams,
(eventPhase: string, apiObj: V1Pod | V1Status) =>
this.handleWatchMessage(eventPhase, apiObj, listener, params),
(error: unknown) => this.handleWatchError(error, path),
(error: unknown) => {
this.handleWatchError(error, path);
request.destroy();
},
);

this.stopWatch = () => request.destroy();
Expand Down

0 comments on commit 9834cd4

Please sign in to comment.