-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: skip proxy health check if connection is not active #1595
Conversation
74bdd96
to
ac5aedf
Compare
Also need to handle the |
Please also update the doc for these sections:
|
ed40f0a
to
bb18970
Compare
The above has been revised, PTAL, thanks. @imeoer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
others LGTM, thanks!
api/src/config.rs
Outdated
@@ -938,6 +942,9 @@ pub struct MirrorConfig { | |||
/// Maximum number of failures before marking a mirror as unusable. | |||
#[serde(default = "default_failure_limit")] | |||
pub failure_limit: u8, | |||
/// Elapsed time to pause mirror health check when the request is inactive, in seconds. | |||
#[serde(default = "default_check_pause_elapsed")] | |||
pub check_pause_elapsed: u64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have health_check_interval
, so maybe name it health_check_pause_elapsed
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, PTAL :) @imeoer
1. Add last_active field for Connection. When Connection.call() is called, last_active is updated to current timestamp. 2. Add check_pause_elapsed field for ProxyConfig and MirrorConfig. Connection is considered to be inactive if the current time to the last_active time exceeds check_pause_elapsed. 3. In proxy and mirror's health checking thread's loop, if the connection is not active (exceeds check_pause_elapsed), this round of health check is skipped. 4. Update the document. Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
Signed-off-by: BruceAko <chongzhi@hust.edu.cn>
Relevant Issue (if applicable)
Fixes #1588
Details
last_active
field forConnection
. WhenConnection.call()
is called,last_active
is updated to current timestamp.check_pause_elapsed
field forProxyConfig
andMirrorConfig
. Connection is considered to be inactive if the current time to thelast_active
time exceedscheck_pause_elapsed
.check_pause_elapsed
), this round of health check is skipped.Types of changes
What types of changes does your PullRequest introduce? Put an
x
in all the boxes that apply:Checklist
Go over all the following points, and put an
x
in all the boxes that apply.