Skip to content

Commit

Permalink
Increase internal proxy timeout from 5 seconds to 10 seconds to fix l…
Browse files Browse the repository at this point in the history
…ong agent ops (#2265)
  • Loading branch information
aviramha authored Feb 23, 2024
1 parent ca91fa8 commit 6815afb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/+internal-proxy-timeout.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Increase internal proxy timeout from 5 seconds to 10 seconds to fix long agent ops
8 changes: 6 additions & 2 deletions mirrord/layer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ static EXECUTABLE_PATH: OnceLock<String> = OnceLock::new();
/// Program arguments
static EXECUTABLE_ARGS: OnceLock<Vec<OsString>> = OnceLock::new();

/// Proxy Connection timeout
/// Set to 10 seconds as most agent operations timeout after 5 seconds
const PROXY_CONNECTION_TIMEOUT: Duration = Duration::from_secs(10);

/// Loads mirrord configuration and does some patching (SIP, dotnet, etc)
fn layer_pre_initialization() -> Result<(), LayerError> {
let given_process = EXECUTABLE_NAME.get_or_try_init(ExecutableName::from_env)?;
Expand Down Expand Up @@ -226,7 +230,7 @@ fn load_only_layer_start(config: &LayerConfig) {
.expect("failed to parse internal proxy address");

let new_connection =
ProxyConnection::new(address, NewSessionRequest::New, Duration::from_secs(5))
ProxyConnection::new(address, NewSessionRequest::New, PROXY_CONNECTION_TIMEOUT)
.expect("failed to initialize proxy connection");

unsafe {
Expand Down Expand Up @@ -354,7 +358,7 @@ fn layer_start(mut config: LayerConfig) {
unsafe {
let address = setup().proxy_address();
let new_connection =
ProxyConnection::new(address, NewSessionRequest::New, Duration::from_secs(5))
ProxyConnection::new(address, NewSessionRequest::New, PROXY_CONNECTION_TIMEOUT)
.expect("failed to initialize proxy connection");
PROXY_CONNECTION
.set(new_connection)
Expand Down

0 comments on commit 6815afb

Please sign in to comment.