From 82b76a9455e33d4cfa0caf93745b5053c9781643 Mon Sep 17 00:00:00 2001 From: tenteen <38925345+tenteen@users.noreply.github.com> Date: Thu, 7 Jun 2018 15:50:18 -0500 Subject: [PATCH] Fix left half timeout during fw update (#567) (#626) The snooze call is skipped in the try block when the command throws an exception. As a result, the command tries maxTry times as fast as possible. The fix is to move the snooze call outside of the try block. PS: #GotMyUHK --- packages/uhk-usb/src/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/uhk-usb/src/util.ts b/packages/uhk-usb/src/util.ts index 2a9ba651..62978309 100644 --- a/packages/uhk-usb/src/util.ts +++ b/packages/uhk-usb/src/util.ts @@ -77,7 +77,6 @@ export async function retry(command: Function, maxTry = 3, logService?: LogServi try { // logService.debug(`[retry] try to run FUNCTION:\n ${command}, \n retry: ${retryCount}`); await command(); - await snooze(100); // logService.debug(`[retry] success FUNCTION:\n ${command}, \n retry: ${retryCount}`); return; } catch (err) { @@ -93,6 +92,7 @@ export async function retry(command: Function, maxTry = 3, logService?: LogServi if (logService) { logService.info(`[retry] failed, but try run FUNCTION:\n ${command}, \n retry: ${retryCount}`); } + await snooze(100); } } }