fix(coderd): Ensure agent disconnect happens after timeout (#6600)

Fixes #6598
This commit is contained in:
Mathias Fredriksson
2023-03-14 15:14:47 +02:00
committed by GitHub
parent 7587850a1c
commit 348530000f
3 changed files with 5 additions and 2 deletions

View File

@ -175,6 +175,10 @@ func New(options *Options) *API {
if options.AgentInactiveDisconnectTimeout == 0 {
// Multiply the update by two to allow for some lag-time.
options.AgentInactiveDisconnectTimeout = options.AgentConnectionUpdateFrequency * 2
// Set a minimum timeout to avoid disconnecting too soon.
if options.AgentInactiveDisconnectTimeout < 2*time.Second {
options.AgentInactiveDisconnectTimeout = 2 * time.Second
}
}
if options.AgentStatsRefreshInterval == 0 {
options.AgentStatsRefreshInterval = 5 * time.Minute