fix(slurm): add default 30s timeout to HTTP client

Replaces http.DefaultClient with a client that has a 30s timeout to prevent indefinite hangs when the Slurm REST API is unresponsive.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
dailz
2026-04-10 09:25:35 +08:00
parent 1359730300
commit c070dd8abc
4 changed files with 13 additions and 8 deletions

View File

@@ -2,7 +2,6 @@ package slurm
import (
"crypto/rand"
"net/http"
"os"
"path/filepath"
"testing"
@@ -61,8 +60,8 @@ func TestNewClientWithOpts_BackwardCompatible(t *testing.T) {
if client == nil {
t.Fatal("expected non-nil client")
}
if client.client != http.DefaultClient {
t.Error("expected http.DefaultClient when no options provided")
if client.client.Timeout != DefaultTimeout {
t.Errorf("expected Timeout=%v, got %v", DefaultTimeout, client.client.Timeout)
}
}