diff --git a/src/raft.c b/src/raft.c index 02b72536..cfa8a493 100644 --- a/src/raft.c +++ b/src/raft.c @@ -730,7 +730,6 @@ int new_election(struct ticket_config *tk, tk->current_term++; } - tk->term_expires = 0; tk->election_end = now + tk->timeout; tk->in_election = 1; @@ -745,7 +744,6 @@ int new_election(struct ticket_config *tk, record_vote(tk, local, new_leader); tk->voted_for = new_leader; - tk->leader = no_leader; tk->state = ST_CANDIDATE; /* some callers may want just to repeat on timeout */ diff --git a/src/ticket.c b/src/ticket.c index d9bb7a48..e2dac31f 100644 --- a/src/ticket.c +++ b/src/ticket.c @@ -818,9 +818,8 @@ static void ticket_cron(struct ticket_config *tk) /* Has an owner, has an expiry date, and expiry date in the past? * Losing the ticket must happen in _every_ state. */ now = get_secs(NULL); - if (!tk->in_election && + if (is_owned(tk) && tk->term_expires && - is_owned(tk) && now >= tk->term_expires) { ticket_lost(tk); goto out;