Skip to content
Snippets Groups Projects

refresh: use exponential retry backoff with base 2 rather than 3

Merged David Vasek requested to merge exponential_retry_backoff into master
1 file
+ 4
5
Compare changes
  • Side-by-side
  • Inline
/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -139,14 +139,13 @@ static time_t bootstrap_next(const zone_timers_t *timers)
{
time_t expired_at = timers->last_refresh + timers->soa_expire;
// previous interval
// Time since the zone expiration.
// The new interval is double of the previous one (an exponential backoff).
time_t interval = timers->next_refresh - expired_at;
if (interval < 0) {
interval = 0;
}
// exponential backoff
interval *= 2;
if (interval > BOOTSTRAP_MAXTIME) {
interval = BOOTSTRAP_MAXTIME;
}
@@ -1258,7 +1257,7 @@ int event_refresh(conf_t *conf, zone_t *zone)
zone->timers.next_refresh = now + knot_soa_refresh(soa->rdata);
zone->timers.last_refresh_ok = true;
} else {
time_t next = 0;
time_t next;
if (soa) {
next = knot_soa_retry(soa->rdata);
} else {
Loading