fix: Elongate agent disconnect timeout in tests (#2687)

This will fix the flake seen here:
https://github.com/coder/coder/runs/7071719863?check_suite_focus=true
This commit is contained in:
Kyle Carberry
2022-06-27 10:06:51 -05:00
committed by GitHub
parent 4a2d29948e
commit 08f4b193e1
5 changed files with 20 additions and 12 deletions

View File

@ -47,6 +47,7 @@ type Options struct {
CacheDir string
AgentConnectionUpdateFrequency time.Duration
AgentInactiveDisconnectTimeout time.Duration
// APIRateLimit is the minutely throughput rate limit per user or ip.
// Setting a rate limit <0 will disable the rate limiter across the entire
// app. Specific routes may have their own limiters.
@ -69,6 +70,10 @@ func New(options *Options) *API {
if options.AgentConnectionUpdateFrequency == 0 {
options.AgentConnectionUpdateFrequency = 3 * time.Second
}
if options.AgentInactiveDisconnectTimeout == 0 {
// Multiply the update by two to allow for some lag-time.
options.AgentInactiveDisconnectTimeout = options.AgentConnectionUpdateFrequency * 2
}
if options.APIRateLimit == 0 {
options.APIRateLimit = 512
}