Do not setLastStateChangeToNow every 5 seconds

This commit is contained in:
Juan Font 2022-04-30 14:47:16 +00:00 committed by GitHub
parent 28efd92fca
commit 843e2bd9b6

4
app.go
View file

@ -292,11 +292,13 @@ func (h *Headscale) expireEphemeralNodesWorker() {
return
}
expiredFound := false
for _, machine := range machines {
if machine.AuthKey != nil && machine.LastSeen != nil &&
machine.AuthKey.Ephemeral &&
time.Now().
After(machine.LastSeen.Add(h.cfg.EphemeralNodeInactivityTimeout)) {
expiredFound = true
log.Info().
Str("machine", machine.Name).
Msg("Ephemeral client removed from database")
@ -311,9 +313,11 @@ func (h *Headscale) expireEphemeralNodesWorker() {
}
}
if expiredFound {
h.setLastStateChangeToNow(namespace.Name)
}
}
}
func (h *Headscale) grpcAuthenticationInterceptor(ctx context.Context,
req interface{},