diff options
Diffstat (limited to 'src/dns_updater.rs')
-rw-r--r-- | src/dns_updater.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/dns_updater.rs b/src/dns_updater.rs index e525f8a..98708ce 100644 --- a/src/dns_updater.rs +++ b/src/dns_updater.rs @@ -27,9 +27,6 @@ pub async fn dns_updater_task( ); } - info!("DNS updater will start in 5 seconds"); - tokio::time::sleep(Duration::from_secs(5)).await; - info!("DNS updater starting"); let mut config = Arc::new(DnsConfig::new()); @@ -42,7 +39,13 @@ pub async fn dns_updater_task( } _ = must_exit.changed() => continue, ); - let new_config: Arc<DnsConfig> = rx_dns_config.borrow().clone(); + + // Always lag 15 seconds behind actual updates, + // to avoid sending too many at once and hitting rate limits + // TODO: retry regularly rate limits are hit + tokio::time::sleep(Duration::from_secs(15)).await; + + let new_config: Arc<DnsConfig> = rx_dns_config.borrow_and_update().clone(); for (key, value) in new_config.entries.iter() { // Skip entries that haven't changed |