Skip to content

Commit

Permalink
Initialize token buckets with the maximum number of tokens
Browse files Browse the repository at this point in the history
Avoids message discards right after startup.
  • Loading branch information
alexandergall committed Oct 5, 2015
1 parent c67235b commit 18c4436
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function token_bucket:rate (rate)
if rate ~= nil then
self._rate = rate
self._max_tokens = math.max(rate, 1)
self._tokens = 0
self._tokens = self._max_tokens
end
return self._rate
end
Expand Down

0 comments on commit 18c4436

Please sign in to comment.