File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -1095,11 +1095,23 @@ fn lookup_txos(
1095
1095
outpoints : & BTreeSet < OutPoint > ,
1096
1096
allow_missing : bool ,
1097
1097
) -> HashMap < OutPoint , TxOut > {
1098
- let pool = rayon:: ThreadPoolBuilder :: new ( )
1099
- . num_threads ( 16 ) // we need to saturate SSD IOPS
1100
- . thread_name ( |i| format ! ( "lookup-txo-{}" , i) )
1101
- . build ( )
1102
- . unwrap ( ) ;
1098
+ let mut loop_count = 10 ;
1099
+ let pool = loop {
1100
+ match rayon:: ThreadPoolBuilder :: new ( )
1101
+ . num_threads ( 16 ) // we need to saturate SSD IOPS
1102
+ . thread_name ( |i| format ! ( "lookup-txo-{}" , i) )
1103
+ . build ( )
1104
+ {
1105
+ Ok ( pool) => break pool,
1106
+ Err ( e) => {
1107
+ if loop_count == 0 {
1108
+ panic ! ( "schema::lookup_txos failed to create a ThreadPool: {}" , e) ;
1109
+ }
1110
+ std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 50 ) ) ;
1111
+ loop_count -= 1 ;
1112
+ }
1113
+ }
1114
+ } ;
1103
1115
pool. install ( || {
1104
1116
outpoints
1105
1117
. par_iter ( )
You can’t perform that action at this time.
0 commit comments