From 0db7fc5ab726937e7ab860fd917a70f84dae5927 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Tue, 16 Aug 2022 13:39:15 +0200 Subject: [PATCH] Mark all namespaces to lastChange now --- app.go | 2 +- machine.go | 8 ++++---- protocol_common_poll.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app.go b/app.go index 7722bf79..966fb3a9 100644 --- a/app.go +++ b/app.go @@ -270,7 +270,7 @@ func (h *Headscale) expireEphemeralNodesWorker() { } if expiredFound { - h.setLastStateChangeToNow(namespace.Name) + h.setLastStateChangeToNow() } } } diff --git a/machine.go b/machine.go index d9fd789d..1773e8ff 100644 --- a/machine.go +++ b/machine.go @@ -410,7 +410,7 @@ func (h *Headscale) SetTags(machine *Machine, tags []string) error { if err := h.UpdateACLRules(); err != nil && !errors.Is(err, errEmptyPolicy) { return err } - h.setLastStateChangeToNow(machine.Namespace.Name) + h.setLastStateChangeToNow() if err := h.db.Save(machine).Error; err != nil { return fmt.Errorf("failed to update tags for machine in the database: %w", err) @@ -424,7 +424,7 @@ func (h *Headscale) ExpireMachine(machine *Machine) error { now := time.Now() machine.Expiry = &now - h.setLastStateChangeToNow(machine.Namespace.Name) + h.setLastStateChangeToNow() if err := h.db.Save(machine).Error; err != nil { return fmt.Errorf("failed to expire machine in the database: %w", err) @@ -451,7 +451,7 @@ func (h *Headscale) RenameMachine(machine *Machine, newName string) error { } machine.GivenName = newName - h.setLastStateChangeToNow(machine.Namespace.Name) + h.setLastStateChangeToNow() if err := h.db.Save(machine).Error; err != nil { return fmt.Errorf("failed to rename machine in the database: %w", err) @@ -467,7 +467,7 @@ func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) error { machine.LastSuccessfulUpdate = &now machine.Expiry = &expiry - h.setLastStateChangeToNow(machine.Namespace.Name) + h.setLastStateChangeToNow() if err := h.db.Save(machine).Error; err != nil { return fmt.Errorf( diff --git a/protocol_common_poll.go b/protocol_common_poll.go index f8265d38..65dcb556 100644 --- a/protocol_common_poll.go +++ b/protocol_common_poll.go @@ -125,7 +125,7 @@ func (h *Headscale) handlePollCommon( // There has been an update to _any_ of the nodes that the other nodes would // need to know about - h.setLastStateChangeToNow(machine.Namespace.Name) + h.setLastStateChangeToNow() // The request is not ReadOnly, so we need to set up channels for updating // peers via longpoll