diff options
| author | Matt Joiner <anacrolix@gmail.com> | 2020-10-02 17:34:14 +1000 |
|---|---|---|
| committer | Matt Joiner <anacrolix@gmail.com> | 2020-10-02 17:34:14 +1000 |
| commit | d34224444e049161c83557e72e88943bd732d89d (patch) | |
| tree | 3eebb9b507ddb1dacd87affe90ff522d52d911a0 /rate | |
| parent | Add retry profiling (diff) | |
| download | stm-d34224444e049161c83557e72e88943bd732d89d.tar.gz stm-d34224444e049161c83557e72e88943bd732d89d.tar.xz | |
Use builtin eq var in rate and stmutil
In particular, in the rate limiter this gives a massive performance increase.
Diffstat (limited to 'rate')
| -rw-r--r-- | rate/ratelimit.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rate/ratelimit.go b/rate/ratelimit.go index 69d6932..a44f383 100644 --- a/rate/ratelimit.go +++ b/rate/ratelimit.go @@ -37,7 +37,7 @@ func Every(interval time.Duration) Limit { func NewLimiter(rate Limit, burst numTokens) *Limiter { rl := &Limiter{ max: stm.NewVar(burst), - cur: stm.NewVar(burst), + cur: stm.NewBuiltinEqVar(burst), lastAdd: stm.NewVar(time.Now()), rate: rate, } |
