Skip to content

Hyper 1.0.0-rc.3 - how to gracefully shutdown server connection after time delay? #3239

Discussion options

You must be logged in to vote

After more testing - have come up with below code:

  1. When connection is first opened, wait for CONNECTION_MAX_LIFETIME_DURATION = 2 mins to time out connection
  2. After CONNECTION_MAX_LIFETIME_DURATION call conn.graceful_shutdown()
  3. Do a second loop on the tokio::select! in case of in-progress request when CONNECTION_MAX_LIFETIME_DURATION elapsed
  4. Wait for CONNECTION_GRACEFUL_SHUTDOWN_DURATION = 5 seconds on second loop to give time for graceful shutdown

In tests have observed:

  1. I can force an in-process request when the first iteration (2 minute timer) elapses, and the request finishes during the second iteration (5 second timer) - I see response returned successfully to the caller
  2. If no in-f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aaronriekenberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant