Skip to content

Commit

Permalink
Improve latency
Browse files Browse the repository at this point in the history
  • Loading branch information
resetius committed Nov 28, 2023
1 parent 20ce097 commit bd21b32
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/raft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ std::unique_ptr<TResult> TRaft::Leader(ITimeSource::Time now, TMessageHolder<TMe
memcpy(entry->Data, command->Data, dataSize);
entry->Term = State->CurrentTerm;
log.push_back(entry);
auto index = log.size();
auto index = log.size()-1;
auto nextState = std::make_unique<TState>(TState {
.CurrentTerm = State->CurrentTerm,
.VotedFor = State->VotedFor,
Expand All @@ -360,6 +360,7 @@ std::unique_ptr<TResult> TRaft::Leader(ITimeSource::Time now, TMessageHolder<TMe
.NextState = std::move(nextState),
.NextVolatileState = std::make_unique<TVolatileState>(nextVolatileState),
.Message = mes,
.Messages = CreateAppendEntries()
});
} else if (auto maybeVoteRequest = message.Maybe<TRequestVoteRequest>()) {
return OnRequestVote(std::move(maybeVoteRequest.Cast()));
Expand Down

0 comments on commit bd21b32

Please sign in to comment.