Use opts.abortController.abort?.() if present

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
This commit is contained in:
Hung-Han (Henry) Chen committed 2021-11-23 09:22:44 +02:00
1 parent e6e0ce05d2
commit 2f478f1b9d
1 file changed
+5 -1
+5 -1
View File
@@ -584,7 +584,11 @@ export class KubeApi<T extends KubeObject> {
logger.info(`[KUBE-API] system suspended, abort watching of ${watchUrl}...`);
try {
abort();
if (opts.abortController) {
opts.abortController.abort?.();
} else {
abort?.();
}
} catch (error) {
logger.error(`[KUBE-API] error aborting watch (${watchId})`, error);
}