raft: get rid of the using of defer in critical path