mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
Merge pull request #16624 from keszybz/timesync-retry-interval
Make timesyncd retry interval grow more slowly
This commit is contained in:
commit
3660da17b0
@ -409,7 +409,7 @@ static int print_ntp_status_info(NTPStatusInfo *i) {
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
r = table_add_cell_stringf(table, NULL, "%s (%s)", i->server_address, i->server_name);
|
||||
r = table_add_cell_stringf(table, NULL, "%s (%s)", strna(i->server_address), strna(i->server_name));
|
||||
if (r < 0)
|
||||
return table_log_add_error(r);
|
||||
|
||||
|
@ -137,11 +137,10 @@ static int manager_send_request(Manager *m) {
|
||||
}
|
||||
|
||||
/* re-arm timer with increasing timeout, in case the packets never arrive back */
|
||||
if (m->retry_interval > 0) {
|
||||
if (m->retry_interval < m->poll_interval_max_usec)
|
||||
m->retry_interval *= 2;
|
||||
} else
|
||||
m->retry_interval = m->poll_interval_min_usec;
|
||||
if (m->retry_interval == 0)
|
||||
m->retry_interval = NTP_RETRY_INTERVAL_MIN_USEC;
|
||||
else
|
||||
m->retry_interval = MIN(m->retry_interval * 4/3, NTP_RETRY_INTERVAL_MAX_USEC);
|
||||
|
||||
r = manager_arm_timer(m, m->retry_interval);
|
||||
if (r < 0)
|
||||
|
@ -24,6 +24,9 @@ typedef struct Manager Manager;
|
||||
#define NTP_POLL_INTERVAL_MIN_USEC (32 * USEC_PER_SEC)
|
||||
#define NTP_POLL_INTERVAL_MAX_USEC (2048 * USEC_PER_SEC)
|
||||
|
||||
#define NTP_RETRY_INTERVAL_MIN_USEC (15 * USEC_PER_SEC)
|
||||
#define NTP_RETRY_INTERVAL_MAX_USEC (6 * 60 * USEC_PER_SEC) /* 6 minutes */
|
||||
|
||||
struct Manager {
|
||||
sd_bus *bus;
|
||||
sd_event *event;
|
||||
|
Loading…
Reference in New Issue
Block a user