Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
refactor: use the built-in max/min to simplify the code (#6430)
somasoilf7a61867315f
diff --git a/internal/ratelimit/ratelimit.go b/internal/ratelimit/ratelimit.goindex 6862d21c5..09ad21ae3 100644--- a/internal/ratelimit/ratelimit.go+++ b/internal/ratelimit/ratelimit.go@@ -371,10 +371,7 @@ func (e *entry) retryAfter(rule Rule, now time.Time, cost int) time.Duration {// previous one, has decayed: overlap < (budget + 1) / current.ready = windowEnd.Add(decayTime(rule.Window, e.current, budget+1))}- wait := ready.Sub(now)- if wait < 0 {- wait = 0- }+ wait := max(ready.Sub(now), 0)// Floor plus one second lands strictly after the boundary even when the// wait is a whole number of seconds, and is never less than one.return time.Duration(math.Floor(wait.Seconds()))*time.Second + time.Second