Skip to content

Commit

Permalink
[Update PR] Indent and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
greensky00 committed Jan 16, 2025
1 parent d09df49 commit cf99203
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
19 changes: 10 additions & 9 deletions include/libnuraft/raft_params.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ struct raft_params {
}

/**
* Timeout for syncing the snapshot requests.
*
* @param timeout_ms
* @return self
*/
* Timeout for syncing the snapshot requests.
*
* @param timeout_ms
* @return self
*/
raft_params& with_snapshot_sync_ctx_timeout(int32 timeout_ms) {
snapshot_sync_ctx_timeout_ = timeout_ms;
return *this;
Expand Down Expand Up @@ -418,10 +418,11 @@ public:
int32 snapshot_block_size_;

/**
* Timeout(ms) for snapshot_sync_ctx, if a single snapshot syncing request exceeds this,
* it will be considered as timeout and ctx will be released.
* 0 means it will be set to the default value `heart_beat_interval_ * response_limit_`.
*/
* Timeout(ms) for snapshot_sync_ctx, if a single snapshot syncing request
* exceeds this, it will be considered as timeout and ctx will be released.
* 0 means it will be set to the default value
* `heart_beat_interval_ * response_limit_`.
*/
int32 snapshot_sync_ctx_timeout_;

/**
Expand Down
7 changes: 5 additions & 2 deletions src/handle_join_leave.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ ptr<resp_msg> raft_server::handle_add_srv_req(req_msg& req) {
srv_to_join_->get_id(),
last_active_ms);

ulong sync_timeout = (ulong)raft_limits_.response_limit_
* ctx_->get_params()->heart_beat_interval_;
// NOTE:
// If snapshot transmission was in progress, we will follow the
// snapshot timeout. Otherwise, we will follow the response timeout.
ulong sync_timeout = (ulong)raft_limits_.response_limit_ *
ctx_->get_params()->heart_beat_interval_;
if (srv_to_join_->get_snapshot_sync_ctx()) {
sync_timeout = (ulong)get_snapshot_sync_ctx_timeout();
}
Expand Down

0 comments on commit cf99203

Please sign in to comment.