Now, the _server_append_entries method sends entries. If adding an element fails, it decrements the value of self._next_index[remote_node_index]. If adding the element succeeds, it increments this value.
This way we avoid the case where the new leader rewrites all the logs anew, even if they already exist on the follower.
Additionally, the _serve_append_entries method was modified: new if-conditions were added, and the element removal function was moved from the _append_entries_processing method to this one.
Now, the
_server_append_entries
method sends entries. If adding an element fails, it decrements the value ofself._next_index[remote_node_index]
. If adding the element succeeds, it increments this value. This way we avoid the case where the new leader rewrites all the logs anew, even if they already exist on the follower.Additionally, the
_serve_append_entries
method was modified: new if-conditions were added, and the element removal function was moved from the_append_entries_processing
method to this one.