Clear autosync_timer when autosync_interval is set to 0

Clear other timers similarly (but their interval can't be 0)
This commit is contained in:
Vitaliy Filippov
2026-06-20 01:50:44 +03:00
parent 826b35b369
commit cf3abdb9e3
+24 -3
View File
@@ -352,30 +352,51 @@ void osd_t::parse_config(bool init)
{ {
peering_state = peering_state | OSD_RECOVERING; peering_state = peering_state | OSD_RECOVERING;
} }
if (old_autosync_interval != autosync_interval && autosync_timer_id >= 0) if (old_autosync_interval != autosync_interval)
{
if (autosync_timer_id >= 0)
{ {
this->tfd->clear_timer(autosync_timer_id); this->tfd->clear_timer(autosync_timer_id);
autosync_timer_id = -1;
}
if (autosync_interval != 0)
{
autosync_timer_id = this->tfd->set_timer(autosync_interval*1000, true, [this](int timer_id) autosync_timer_id = this->tfd->set_timer(autosync_interval*1000, true, [this](int timer_id)
{ {
autosync(); autosync();
}); });
} }
if (old_print_stats_interval != print_stats_interval && print_stats_timer_id >= 0) }
if (old_print_stats_interval != print_stats_interval)
{
if (print_stats_timer_id >= 0)
{ {
tfd->clear_timer(print_stats_timer_id); tfd->clear_timer(print_stats_timer_id);
print_stats_timer_id = -1;
}
if (print_stats_interval != 0)
{
print_stats_timer_id = this->tfd->set_timer(print_stats_interval*1000, true, [this](int timer_id) print_stats_timer_id = this->tfd->set_timer(print_stats_interval*1000, true, [this](int timer_id)
{ {
print_stats(); print_stats();
}); });
} }
if (old_slow_log_interval != slow_log_interval && slow_log_timer_id >= 0) }
if (old_slow_log_interval != slow_log_interval)
{
if (slow_log_timer_id >= 0)
{ {
tfd->clear_timer(slow_log_timer_id); tfd->clear_timer(slow_log_timer_id);
slow_log_timer_id = -1;
}
if (slow_log_interval != 0)
{
slow_log_timer_id = this->tfd->set_timer(slow_log_interval*1000, true, [this](int timer_id) slow_log_timer_id = this->tfd->set_timer(slow_log_interval*1000, true, [this](int timer_id)
{ {
print_slow(); print_slow();
}); });
} }
}
if (old_recovery_tune_interval != recovery_tune_interval) if (old_recovery_tune_interval != recovery_tune_interval)
{ {
apply_recovery_tune_interval(); apply_recovery_tune_interval();