Skip to content

Commit

Permalink
Use ticker instead of timer for batch wait
Browse files Browse the repository at this point in the history
Fixes #280
  • Loading branch information
ctrox authored and Ed Welch committed Sep 5, 2019
1 parent 8f9cd97 commit dca8a4f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/promtail/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func New(cfg Config, logger log.Logger) (Client, error) {
func (c *client) run() {
batch := map[model.Fingerprint]*logproto.Stream{}
batchSize := 0
maxWait := time.NewTimer(c.cfg.BatchWait)
maxWait := time.NewTicker(c.cfg.BatchWait)

defer func() {
if len(batch) > 0 {
Expand All @@ -120,7 +120,6 @@ func (c *client) run() {
}()

for {
maxWait.Reset(c.cfg.BatchWait)
select {
case <-c.quit:
return
Expand Down

0 comments on commit dca8a4f

Please sign in to comment.