Unverified Commit 03e2f294 authored by Ozan Tezcan's avatar Ozan Tezcan Committed by GitHub
Browse files

Do not execute operations in periodic when auto_flush is off (#109)

Do not execute operations in periodic when auto_flush is off 

Introduced auto_flush config in #81. If auto_flush is off, application is supposed to call raft_flush() manually. This function increments commit index, applies entries and sends appendentries requests.

Currently, we execute operations in raft_periodic() and raft_flush() both. When auto_flush is off, it makes sense to leave execution to raft_flush() to do it in a single place.
parent 3dcf5256
...@@ -645,7 +645,11 @@ int raft_periodic_internal(raft_server_t *me, ...@@ -645,7 +645,11 @@ int raft_periodic_internal(raft_server_t *me,
return e; return e;
} }
return raft_exec_operations(me); if (me->auto_flush) {
return raft_exec_operations(me);
}
return 0;
} }
raft_entry_t* raft_get_entry_from_idx(raft_server_t* me, raft_index_t etyidx) raft_entry_t* raft_get_entry_from_idx(raft_server_t* me, raft_index_t etyidx)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment