fix(multiplayer): bound adapter HTTP calls

This commit is contained in:
Josh Creek
2026-09-02 19:12:40 +01:00
parent cbefa86c5c
commit 1bce603c33
5 changed files with 36 additions and 11 deletions
+5 -2
View File
@@ -106,7 +106,10 @@ type Supervisor struct {
lastGameServer GameServer
}
const DefaultDrainGrace = 285 * time.Second
const (
DefaultDrainGrace = 285 * time.Second
DefaultHTTPTimeout = 10 * time.Second
)
func New(config Config) (*Supervisor, error) {
if len(config.Command) == 0 || config.Command[0] == "" {
@@ -131,7 +134,7 @@ func New(config Config) (*Supervisor, error) {
return nil, fmt.Errorf("unsupported transport %q", config.Transport)
}
if config.HTTPClient == nil {
config.HTTPClient = http.DefaultClient
config.HTTPClient = &http.Client{Timeout: DefaultHTTPTimeout}
}
if (config.DrainURL == "") != (config.DrainToken == "") {
return nil, fmt.Errorf("drain URL and token must be configured together")