Skip to content

Commit 8e59243

Browse files
committed
Drop wallet lock before sleeping and retrying
.. no need to keep the wallet locked if we're sleeping. So we're dropping and re-locking.
1 parent 154b0a8 commit 8e59243

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/wallet.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,18 @@ where
109109
Err(e) => match e {
110110
bdk::Error::Esplora(ref be) => match **be {
111111
bdk::blockchain::esplora::EsploraError::Reqwest(_) => {
112+
// Drop lock, sleep for a second, retry.
113+
drop(wallet_lock);
112114
tokio::time::sleep(Duration::from_secs(1)).await;
113115
log_error!(
114116
self.logger,
115117
"Sync failed due to HTTP connection error, retrying: {}",
116118
e
117119
);
118120
let sync_options = SyncOptions { progress: None };
119-
wallet_lock
121+
self.inner
122+
.lock()
123+
.unwrap()
120124
.sync(&self.blockchain, sync_options)
121125
.await
122126
.map_err(|e| From::from(e))

0 commit comments

Comments
 (0)