Reduce useless updates to help avoid rate limiting
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2e3442faa9
commit
5731ad022b
1 changed files with 7 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue