Skip to content

Commit bca62f0

Browse files
committed
api/backup: yield to avoid timeout
Maybe not strictly needed, but to reduce the chance of comms timeout, we yield after copy_seed.
1 parent 16b2004 commit bca62f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/rust/bitbox02-rust/src/hww/api/backup.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ pub async fn create(
104104
}
105105

106106
let seed = bitbox02::keystore::copy_seed()?;
107+
108+
// Yield now to give executor a chance to process USB/BLE communication, as copy_seed() causes
109+
// some delay.
110+
futures_lite::future::yield_now().await;
111+
107112
let seed_birthdate = if !is_initialized {
108113
if bitbox02::memory::set_seed_birthdate(timestamp).is_err() {
109114
return Err(Error::Memory);

0 commit comments

Comments
 (0)