mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-20 19:09:07 +01:00
Mark all namespaces to lastChange now
This commit is contained in:
parent
eb461d0713
commit
0db7fc5ab7
2
app.go
2
app.go
@ -270,7 +270,7 @@ func (h *Headscale) expireEphemeralNodesWorker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if expiredFound {
|
if expiredFound {
|
||||||
h.setLastStateChangeToNow(namespace.Name)
|
h.setLastStateChangeToNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ func (h *Headscale) SetTags(machine *Machine, tags []string) error {
|
|||||||
if err := h.UpdateACLRules(); err != nil && !errors.Is(err, errEmptyPolicy) {
|
if err := h.UpdateACLRules(); err != nil && !errors.Is(err, errEmptyPolicy) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
h.setLastStateChangeToNow(machine.Namespace.Name)
|
h.setLastStateChangeToNow()
|
||||||
|
|
||||||
if err := h.db.Save(machine).Error; err != nil {
|
if err := h.db.Save(machine).Error; err != nil {
|
||||||
return fmt.Errorf("failed to update tags for machine in the database: %w", err)
|
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()
|
now := time.Now()
|
||||||
machine.Expiry = &now
|
machine.Expiry = &now
|
||||||
|
|
||||||
h.setLastStateChangeToNow(machine.Namespace.Name)
|
h.setLastStateChangeToNow()
|
||||||
|
|
||||||
if err := h.db.Save(machine).Error; err != nil {
|
if err := h.db.Save(machine).Error; err != nil {
|
||||||
return fmt.Errorf("failed to expire machine in the database: %w", err)
|
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
|
machine.GivenName = newName
|
||||||
|
|
||||||
h.setLastStateChangeToNow(machine.Namespace.Name)
|
h.setLastStateChangeToNow()
|
||||||
|
|
||||||
if err := h.db.Save(machine).Error; err != nil {
|
if err := h.db.Save(machine).Error; err != nil {
|
||||||
return fmt.Errorf("failed to rename machine in the database: %w", err)
|
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.LastSuccessfulUpdate = &now
|
||||||
machine.Expiry = &expiry
|
machine.Expiry = &expiry
|
||||||
|
|
||||||
h.setLastStateChangeToNow(machine.Namespace.Name)
|
h.setLastStateChangeToNow()
|
||||||
|
|
||||||
if err := h.db.Save(machine).Error; err != nil {
|
if err := h.db.Save(machine).Error; err != nil {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
|
@ -125,7 +125,7 @@ func (h *Headscale) handlePollCommon(
|
|||||||
|
|
||||||
// There has been an update to _any_ of the nodes that the other nodes would
|
// There has been an update to _any_ of the nodes that the other nodes would
|
||||||
// need to know about
|
// 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
|
// The request is not ReadOnly, so we need to set up channels for updating
|
||||||
// peers via longpoll
|
// peers via longpoll
|
||||||
|
Loading…
Reference in New Issue
Block a user