1
0
mirror of https://github.com/netbirdio/netbird.git synced 2025-07-08 18:36:58 +02:00

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
This commit is contained in:
Maycon Santos
2024-03-06 15:18:53 +01:00
committed by GitHub
parent 6d747b2f83
commit 0aeb87742a

@ -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
}
}