fix(usb-deployer): rebalance sync retries/backoff for optiboot window
This commit is contained in:
parent
2fd2b1b5b4
commit
852fccacdf
|
|
@ -545,14 +545,12 @@ export class USBHardwareDeployer implements HardwareDeployer {
|
||||||
console.log(`[USB] get_sync attempt ${attempt + 1} failed:`, e);
|
console.log(`[USB] get_sync attempt ${attempt + 1} failed:`, e);
|
||||||
/* Drain stray bytes before retry */
|
/* Drain stray bytes before retry */
|
||||||
await this.drainStray();
|
await this.drainStray();
|
||||||
/* Exponential backoff: 20ms, 40ms, 80ms, ... max 200ms */
|
/* Exponential backoff: 20ms, 40ms, 80ms, ... capped at 150ms */
|
||||||
const delay = Math.min(20 * Math.pow(2, attempt), 200);
|
const delay = Math.min(20 * Math.pow(2, attempt), 150);
|
||||||
await sleep(delay);
|
await sleep(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new Error(
|
throw new Error(`get_sync failed after ${STK_SYNC_RETRIES} attempts`);
|
||||||
`get_sync failed after ${STK_SYNC_RETRIES} attempts`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getSignature(): Promise<Uint8Array> {
|
private async getSignature(): Promise<Uint8Array> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue