Add close-sessions-duration config key #827
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Active sessions of a stopping instance (
haproxy -sf -x
) are terminated just afterhard-stop-after
(ourtimeout-stop
) times out and just before the old haproxy instance terminates. All the sessions at the same time. This option adds the ability to start the shutdown session at a configured time before the instance times out.This is done on top of two new implementations: now sockets can be configured to leave the connection open, so we have a way to reach the stopping instance since its admin socket isn't being listened anymore (standalone/embedded only, we could reach an old instance using master/worker mode).
The other one is a new struct and associated funcs called connections, that holds the master socket (if used), admin sockets, a list of stopping instances, and also controls concurrent access. The instances list can be used by functionalities that need to read or change their state.
close-sessions-duration
is built on top of them. A new goroutine starts whentimeout - duration
time has passed after the reload, and fairly distributes shutdowns along the remaining time of the instance.