Skip to content

Commit

Permalink
Add some logging to server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Mar 13, 2017
1 parent 1e6c6fc commit cb53fc3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@ impl<C: CommandCreatorSync> SccacheServer<C> {
handle: handle.clone(),
timeout_dur: timeout,
};
let shutdown_idle = shutdown_idle.map(|a| {
info!("shutting down due to being idle");
a
});

let shutdown = shutdown.map(|a| {
info!("shutting down due to explicit signal");
a
});

let server = future::select_all(vec![
Box::new(server) as Box<Future<Item=_, Error=_>>,
Expand All @@ -253,6 +262,9 @@ impl<C: CommandCreatorSync> SccacheServer<C> {
core.run(server)
.map_err(|p| p.0)?;

info!("moving into the shutdown phase now, waiting at most 10 seconds \
for all client requests to complete");

// Once our server has shut down either due to inactivity or a manual
// request we still need to give a bit of time for all active
// connections to finish. This `wait` future will resolve once all
Expand All @@ -263,6 +275,8 @@ impl<C: CommandCreatorSync> SccacheServer<C> {
core.run(wait.select(Timeout::new(Duration::new(10, 0), &handle)?))
.map_err(|p| p.0)?;

info!("ok, fully shutting down now");

Ok(())
}
}
Expand Down

0 comments on commit cb53fc3

Please sign in to comment.