mirror of
https://github.com/go-acme/lego.git
synced 2024-11-21 13:25:48 +02:00
fix(ari): avoid Int63n panic in ShouldRenewAt() (#2246)
This commit is contained in:
parent
c083a989a1
commit
29e98f8a43
@ -41,9 +41,11 @@ func (r *RenewalInfoResponse) ShouldRenewAt(now time.Time, willingToSleep time.D
|
||||
end := r.SuggestedWindow.End.UTC()
|
||||
|
||||
// Select a uniform random time within the suggested window.
|
||||
window := end.Sub(start)
|
||||
randomDuration := time.Duration(rand.Int63n(int64(window)))
|
||||
rt := start.Add(randomDuration)
|
||||
rt := start
|
||||
if window := end.Sub(start); window > 0 {
|
||||
randomDuration := time.Duration(rand.Int63n(int64(window)))
|
||||
rt = rt.Add(randomDuration)
|
||||
}
|
||||
|
||||
// If the selected time is in the past, attempt renewal immediately.
|
||||
if rt.Before(now) {
|
||||
|
Loading…
Reference in New Issue
Block a user