Fix rate limiting for logger, increase refill rate

Signed-off-by: Ethan Mosbaugh <ethan@replicated.com>
(cherry picked from commit 50c6a5fb07)
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Ethan Mosbaugh 2019-06-12 13:48:36 -07:00 committed by Brian Goff
parent 71373c6105
commit e6c9e2736f
1 changed files with 3 additions and 1 deletions

View File

@ -508,7 +508,9 @@ func (r *controller) Logs(ctx context.Context, publisher exec.LogPublisher, opti
var (
// use a rate limiter to keep things under control but also provides some
// ability coalesce messages.
limiter = rate.NewLimiter(rate.Every(time.Second), 10<<20) // 10 MB/s
// this will implement a "token bucket" of size 10 MB, initially full and refilled
// at rate 10 MB tokens per second.
limiter = rate.NewLimiter(10<<20, 10<<20) // 10 MB/s
msgctx = api.LogContext{
NodeID: r.task.NodeID,
ServiceID: r.task.ServiceID,