From bf9e748f962eae7526724e085b4b3213493f07ed Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 6 Aug 2025 14:14:44 +0000 Subject: [PATCH] ha fix --- hscontrol/state/state.go | 5 +++-- test_output.log | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 test_output.log diff --git a/hscontrol/state/state.go b/hscontrol/state/state.go index b2cbfc94..fa9721cf 100644 --- a/hscontrol/state/state.go +++ b/hscontrol/state/state.go @@ -470,8 +470,9 @@ func (s *State) Disconnect(id types.NodeID) (change.ChangeSet, error) { now := time.Now() s.nodeStore.UpdateNode(id, func(n *types.Node) { n.LastSeen = ptr.To(now) - // Do NOT mark as offline here - let the batcher's grace period handle it - // This ensures DNS continues to work during logout + // Mark as offline immediately in NodeStore - this is the source of truth + // The batcher's grace period will still apply when sending to clients + n.IsOnline = ptr.To(false) }) _, err := s.updateNodeTx(id, func(tx *gorm.DB) error { diff --git a/test_output.log b/test_output.log new file mode 100644 index 00000000..513b955f --- /dev/null +++ b/test_output.log @@ -0,0 +1,34 @@ +2025/08/06 13:42:02 Running pre-flight system checks... +2025/08/06 13:42:02 Using Docker host from context 'default': unix:///var/run/docker.sock +2025/08/06 13:42:02 Using Docker host from context 'default': unix:///var/run/docker.sock +2025/08/06 13:42:02 Using Docker host from context 'default': unix:///var/run/docker.sock +2025/08/06 13:42:02 🔍 System Health Check Results +2025/08/06 13:42:02 ================================ +2025/08/06 13:42:02 ✅ Docker Binary: Docker binary found +2025/08/06 13:42:02 ✅ Docker Daemon: Docker daemon is running and accessible +2025/08/06 13:42:02 ✅ Docker Context: Using Docker context: default +2025/08/06 13:42:02 ✅ Docker Socket: Docker socket accessible (Server: 28.2.2) +2025/08/06 13:42:02 ✅ Golang Image: Golang image golang:1.24.0 is available locally +2025/08/06 13:42:02 ✅ Go Installation: go version go1.24.4 linux/amd64 +2025/08/06 13:42:02 ✅ Git Repository: Running in Git repository +2025/08/06 13:42:02 ✅ Required Files: All required files found +2025/08/06 13:42:02 ================================ +2025/08/06 13:42:02 ✅ All system checks passed - ready to run integration tests! +2025/08/06 13:42:02 Running test: TestHASubnetRouterFailover +2025/08/06 13:42:02 Go version: 1.24.0 +2025/08/06 13:42:02 Timeout: 30m0s +2025/08/06 13:42:02 Use PostgreSQL: false +2025/08/06 13:42:02 Using Docker host from context 'default': unix:///var/run/docker.sock +2025/08/06 13:42:02 Run ID: 20250806-134202-5uivan +2025/08/06 13:42:02 Container name: headscale-test-suite-20250806-134202-5uivan +2025/08/06 13:42:02 Logs directory: control_logs/20250806-134202-5uivan +2025/08/06 13:42:02 Running pre-test cleanup... +2025/08/06 13:42:02 Using Docker host from context 'default': unix:///var/run/docker.sock +Removed 2 test containers +2025/08/06 13:42:02 Using Docker host from context 'default': unix:///var/run/docker.sock +Removed 1 unused networks +2025/08/06 13:42:03 Command: go test ./... -run TestHASubnetRouterFailover -failfast -timeout 30m0s -v +2025/08/06 13:42:03 Image golang:1.24.0 is available locally +2025/08/06 13:42:03 Using Docker socket: /var/run/docker.sock +2025/08/06 13:42:03 Created container: 9e1c3ab2f9fad58d5056bae8d55f7c373653cb2b79590513fdd3e49efe4845f7 +2025/08/06 13:42:03 Starting test: TestHASubnetRouterFailover