From 06be4305fb15815fb3480d49dfd9a35892accee2 Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Wed, 6 Mar 2024 15:18:53 +0100 Subject: [PATCH] Return 1s when next expiration is too low (#1672) 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 } }