File tree 1 file changed +25
-8
lines changed
1 file changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -840,19 +840,36 @@ impl<S: MutinyStorage> MutinyWalletBuilder<S> {
840
840
let device_id = self . storage . get_device_id ( ) ?;
841
841
let max_retries = 10 ;
842
842
let mut retries = 0 ;
843
- while !self
844
- . storage
845
- . fetch_device_lock ( )
846
- . await ?
847
- . is_some_and ( |lock| lock. is_last_locker ( & device_id) )
848
- {
843
+ while retries <= max_retries {
849
844
log_info ! ( logger, "Waiting device lock syncing... {retries}" ) ;
845
+
846
+ match self . storage . fetch_device_lock ( ) . await {
847
+ Ok ( lock_option) => {
848
+ if let Some ( lock) = lock_option {
849
+ if lock. is_last_locker ( & device_id) {
850
+ break ;
851
+ }
852
+ }
853
+ }
854
+ Err ( MutinyError :: FailedParsingVssValue ) => {
855
+ log_info ! ( logger, "Failed to parse VSS value, retrying... {retries}" ) ;
856
+ }
857
+ Err ( e) => {
858
+ log_error ! ( logger, "Error fetching device lock: {:?}" , e) ;
859
+ return Err ( e) ;
860
+ }
861
+ }
862
+
850
863
retries += 1 ;
864
+
851
865
if retries > max_retries {
852
- log_error ! ( logger, "Can't syncing device lock to VSS" ) ;
866
+ log_error ! (
867
+ logger,
868
+ "Can't sync device lock to VSS after {max_retries} attempts"
869
+ ) ;
853
870
return Err ( MutinyError :: AlreadyRunning ) ;
854
871
}
855
- sleep ( 300 ) . await
872
+ sleep ( 300 ) . await ;
856
873
}
857
874
}
858
875
log_debug ! ( logger, "finished checking device lock" ) ;
You can’t perform that action at this time.
0 commit comments