Ensure we always hit our scan target, if only UNTESTED are avail
authorMatt Corallo <git@bluematt.me>
Mon, 3 Jun 2019 19:22:43 +0000 (15:22 -0400)
committerMatt Corallo <git@bluematt.me>
Mon, 3 Jun 2019 19:25:57 +0000 (15:25 -0400)
src/main.rs

index 30c363541ceacd3f269c0aa676da6b95afb18c10..5c7e506a18ba5fa7ba016b77ac9a4874be5afc4f 100644 (file)
@@ -211,10 +211,13 @@ fn poll_dnsseeds() {
                }
                printer.add_line(format!("Added {} new addresses from other DNS seeds", new_addrs), false);
                Delay::new(Instant::now() + Duration::from_secs(60)).then(|_| {
                }
                printer.add_line(format!("Added {} new addresses from other DNS seeds", new_addrs), false);
                Delay::new(Instant::now() + Duration::from_secs(60)).then(|_| {
-                       if !START_SHUTDOWN.load(Ordering::Relaxed) {
-                               poll_dnsseeds();
-                       }
-                       future::ok(())
+                       let store = unsafe { DATA_STORE.as_ref().unwrap() };
+                       store.save_data().then(|_| {
+                               if !START_SHUTDOWN.load(Ordering::Relaxed) {
+                                       poll_dnsseeds();
+                               }
+                               future::ok(())
+                       })
                })
        }));
 }
                })
        }));
 }
@@ -234,14 +237,11 @@ fn scan_net() {
                        scan_node(iter_time, node, false);
                        iter_time += per_iter_time;
                }
                        scan_node(iter_time, node, false);
                        iter_time += per_iter_time;
                }
-               Delay::new(cmp::max(iter_time, start_time + Duration::from_secs(15))).then(|_| {
-                       let store = unsafe { DATA_STORE.as_ref().unwrap() };
-                       store.save_data().then(|_| {
-                               if !START_SHUTDOWN.load(Ordering::Relaxed) {
-                                       scan_net();
-                               }
-                               future::ok(())
-                       })
+               Delay::new(cmp::max(iter_time, start_time + Duration::from_secs(1))).then(|_| {
+                       if !START_SHUTDOWN.load(Ordering::Relaxed) {
+                               scan_net();
+                       }
+                       future::ok(())
                })
        }));
 }
                })
        }));
 }