refactor: support cancel during retry

This commit is contained in:
Kevin Yue 2023-09-01 11:35:22 +08:00
parent 69502b22a9
commit c4fa91f6ea

View File

@ -64,14 +64,19 @@ export const connectPortalAtom = atom(
throw err; throw err;
} }
if (err instanceof AbnormalPortalConfigError) { if (!(err instanceof AbnormalPortalConfigError)) {
throw err;
}
logger.info( logger.info(
`Got abnormal portal config: ${err.message}, retrying...` `Got abnormal portal config: ${err.message}, retrying...`
); );
set(statusAtom, "prelogin");
prelogin = await portalService.prelogin(portal); prelogin = await portalService.prelogin(portal);
continue; const isProcessing = get(isProcessingAtom);
} else { if (!isProcessing) {
throw err; logger.info("Operation cancelled");
break;
} }
} }
} }