mirror of
https://github.com/ceph/ceph
synced 2025-01-03 17:42:36 +00:00
mon/MgrMonitor: cancel timer before resetting it
Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
33494b27f7
commit
a80ff0128a
@ -275,7 +275,7 @@ void MgrMonitor::check_sub(Subscription *sub)
|
||||
*/
|
||||
void MgrMonitor::send_digests()
|
||||
{
|
||||
digest_event = nullptr;
|
||||
cancel_timer();
|
||||
|
||||
const std::string type = "mgrdigest";
|
||||
if (mon->session_map.subs.count(type) == 0)
|
||||
@ -304,6 +304,14 @@ void MgrMonitor::send_digests()
|
||||
mon->timer.add_event_after(g_conf->mon_mgr_digest_period, digest_event);
|
||||
}
|
||||
|
||||
void MgrMonitor::cancel_timer()
|
||||
{
|
||||
if (digest_event) {
|
||||
mon->timer.cancel_event(digest_event);
|
||||
digest_event = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void MgrMonitor::on_active()
|
||||
{
|
||||
if (mon->is_leader())
|
||||
@ -545,7 +553,5 @@ void MgrMonitor::init()
|
||||
|
||||
void MgrMonitor::on_shutdown()
|
||||
{
|
||||
if (digest_event) {
|
||||
mon->timer.cancel_event(digest_event);
|
||||
}
|
||||
cancel_timer();
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ class MgrMonitor : public PaxosService
|
||||
void drop_standby(uint64_t gid);
|
||||
|
||||
Context *digest_event = nullptr;
|
||||
void cancel_timer();
|
||||
|
||||
bool check_caps(MonOpRequestRef op, const uuid_d& fsid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user