The process of sending newer snapshots to the snapshot channel (now named agentsQueue) after inserting the event into the balloon must get removed out the critical path of the insertion operation.
Given that the process of applying changes to the FSM is executed in a serialized way with one single thread, the queuing could lead to a potential stalling situation if the channel gets full. Snapshots should be sent to the channel after committing the command into the WAL, just after resolving the Apply future in the Raft node. This way, the goroutine that handles the HTTP request is responsible for the sending the snapshots freeing up the Raft applying thread.
The process of sending newer snapshots to the snapshot channel (now named agentsQueue) after inserting the event into the balloon must get removed out the critical path of the insertion operation.
Given that the process of applying changes to the FSM is executed in a serialized way with one single thread, the queuing could lead to a potential stalling situation if the channel gets full. Snapshots should be sent to the channel after committing the command into the WAL, just after resolving the Apply future in the Raft node. This way, the goroutine that handles the HTTP request is responsible for the sending the snapshots freeing up the Raft applying thread.