From 18c44363e77e54f825a4bff42334b103e98c2d8f Mon Sep 17 00:00:00 2001 From: Alexander Gall Date: Mon, 5 Oct 2015 12:47:53 +0200 Subject: [PATCH] Initialize token buckets with the maximum number of tokens Avoids message discards right after startup. --- src/core/lib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib.lua b/src/core/lib.lua index b58023e780..14e38dfea3 100644 --- a/src/core/lib.lua +++ b/src/core/lib.lua @@ -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