From 5139a116cc784339f4e660b530ca5f3526d6bb76 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Wed, 6 Mar 2024 15:03:12 +0100 Subject: [PATCH] Return 1s when next expiration is too low using the login expired issue could cause problems with ticker used in the scheduler This change makes 1s the minimum number returned when rescheduling the peer expiration task --- management/server/account.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/management/server/account.go b/management/server/account.go index 43cce41ddc8..9450c95b47c 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -455,6 +455,11 @@ func (a *Account) GetNextPeerExpiration() (time.Duration, bool) { } _, duration := peer.LoginExpired(a.Settings.PeerLoginExpiration) if nextExpiry == nil || duration < *nextExpiry { + // if expiration is below 1s return 1s duration + // this avoids issues with ticker that can't be set to < 0 + if duration < time.Second { + return time.Second, true + } nextExpiry = &duration } }