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
This commit is contained in:
Maycon Santos 2024-03-06 15:18:53 +01:00 committed by GitHub
parent 6d747b2f83
commit 0aeb87742a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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