Skip to content

Commit

Permalink
Add delay between nginx crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
huguesBouvier committed Nov 17, 2021
1 parent d6c9f76 commit c8140ed
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions edge-modules/api-proxy-module/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ use api_proxy_module::{
};
use shutdown_handle::ShutdownHandle;

const MAX_LOOP_INTERVAL_SECONDS: tokio::time::Duration = tokio::time::Duration::from_secs(1);

#[tokio::main]
async fn main() -> Result<()> {
env_logger::builder().filter_level(LevelFilter::Info).init();
Expand Down Expand Up @@ -188,6 +190,10 @@ pub fn nginx_controller_start(
return Ok(());
}
}

// This delay controls how fast the main loop can reconnect once nginx crashed.
// Without this, nginx crashes and restart continuously. Rapidly increasing the size of the logs.
time::sleep(MAX_LOOP_INTERVAL_SECONDS);
}
}
});
Expand Down

0 comments on commit c8140ed

Please sign in to comment.