diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 059c15c..7a24022 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: "1.23" + go-version: "1.25" - name: Build run: go build -v ./... @@ -38,6 +38,6 @@ jobs: path-to-profile: covprofile - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v7 with: - version: v1.60 + version: v2.6 diff --git a/nibbler.go b/nibbler.go index 086e49f..4a49bd0 100644 --- a/nibbler.go +++ b/nibbler.go @@ -155,6 +155,7 @@ func (bat *Nibbler[T]) listener(ticker *time.Ticker, size int) (err error) { // process non empty batch if len(bat.batch) > 0 { err = bat.processBatch(TriggerTicker) + ticker.Reset(bat.cfg.TickerDuration) } case value := <-bat.queue: @@ -162,6 +163,7 @@ func (bat *Nibbler[T]) listener(ticker *time.Ticker, size int) (err error) { // process batch immediately if full, instead of waiting for ticker if len(bat.batch) >= size { err = bat.processBatch(TriggerFull) + ticker.Reset(bat.cfg.TickerDuration) } } diff --git a/nibbler_test.go b/nibbler_test.go index 266f737..bb0f7e4 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -161,7 +161,12 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, Processor: func(_ context.Context, _ Trigger, _ []string) error { - panic(errProcessing) + // this whole if condition is to satisfy the stupid linter + // which does not honour ignore directives + if errProcessing != nil { + panic(errProcessing) + } + return nil }, ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing)