From 821ef4e10f8588a5f4d5d8bbdbf3a4bf371af1be Mon Sep 17 00:00:00 2001 From: Kamaleshwar Nair Date: Mon, 17 Nov 2025 16:35:21 +0100 Subject: [PATCH 01/13] [patch] reset ticker even when batch is processed after full --- nibbler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nibbler.go b/nibbler.go index 086e49f..bdf1f81 100644 --- a/nibbler.go +++ b/nibbler.go @@ -150,6 +150,10 @@ func (bat *Nibbler[T]) Listen() { } func (bat *Nibbler[T]) listener(ticker *time.Ticker, size int) (err error) { + defer func() { + ticker.Reset(bat.cfg.TickerDuration) + }() + select { case <-ticker.C: // process non empty batch From 1dcf0473d451a74cb1de2363d5fea7bd6769f336 Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 16:55:43 +0100 Subject: [PATCH 02/13] [patch] reset ticker whenever batch is processed --- nibbler.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nibbler.go b/nibbler.go index bdf1f81..4a49bd0 100644 --- a/nibbler.go +++ b/nibbler.go @@ -150,15 +150,12 @@ func (bat *Nibbler[T]) Listen() { } func (bat *Nibbler[T]) listener(ticker *time.Ticker, size int) (err error) { - defer func() { - ticker.Reset(bat.cfg.TickerDuration) - }() - select { case <-ticker.C: // process non empty batch if len(bat.batch) > 0 { err = bat.processBatch(TriggerTicker) + ticker.Reset(bat.cfg.TickerDuration) } case value := <-bat.queue: @@ -166,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) } } From 192ece6d084f0989e9ec2d71d1f463b8fd1ccda2 Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:04:48 +0100 Subject: [PATCH 03/13] use Go 1.24 for testing --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 059c15c..2faae21 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.24" - name: Build run: go build -v ./... From c1e2c7645d6cc8241b9c59fe7f1f0cbeee3aa068 Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:07:42 +0100 Subject: [PATCH 04/13] nolint --- nibbler_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nibbler_test.go b/nibbler_test.go index 266f737..6383502 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -161,7 +161,7 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, Processor: func(_ context.Context, _ Trigger, _ []string) error { - panic(errProcessing) + panic(errProcessing) //nolint:gocritic }, ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing) From 51a89b3be361888cd6aceb03d4e265b8f77f18fb Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:10:01 +0100 Subject: [PATCH 05/13] nolint --- nibbler_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nibbler_test.go b/nibbler_test.go index 6383502..0560d1d 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -161,7 +161,7 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, Processor: func(_ context.Context, _ Trigger, _ []string) error { - panic(errProcessing) //nolint:gocritic + panic(errProcessing) //nolint:typecheck }, ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing) From 716d9b6a54c6d5fcc1649d80175aa6bc83f3c1bc Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:12:11 +0100 Subject: [PATCH 06/13] nolint --- nibbler_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nibbler_test.go b/nibbler_test.go index 0560d1d..90e48e7 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -161,8 +161,8 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, Processor: func(_ context.Context, _ Trigger, _ []string) error { - panic(errProcessing) //nolint:typecheck - }, + panic(errProcessing) + }, //nolint:typecheck ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing) asserter.ElementsMatch([]string{"hello"}, failedBatch) From 045c01839716a4976821497256a91903fe0b3eba Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:14:42 +0100 Subject: [PATCH 07/13] nolint --- nibbler_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nibbler_test.go b/nibbler_test.go index 90e48e7..5586e1d 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -162,7 +162,8 @@ func TestProcessorErr(tt *testing.T) { TickerDuration: time.Second, Processor: func(_ context.Context, _ Trigger, _ []string) error { panic(errProcessing) - }, //nolint:typecheck + }, + //nolint:typecheck ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing) asserter.ElementsMatch([]string{"hello"}, failedBatch) From 96555e3c69ec7382512e55da4389622d2a3df937 Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:16:57 +0100 Subject: [PATCH 08/13] nolint --- nibbler_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nibbler_test.go b/nibbler_test.go index 5586e1d..399bf66 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -160,10 +160,9 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, - Processor: func(_ context.Context, _ Trigger, _ []string) error { + Processor: func(_ context.Context, _ Trigger, _ []string) error { //nolint:typecheck panic(errProcessing) }, - //nolint:typecheck ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing) asserter.ElementsMatch([]string{"hello"}, failedBatch) From 3f67ee3c26a5a78fa93d603baf4a48871f5a842f Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:22:27 +0100 Subject: [PATCH 09/13] nolint --- nibbler_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nibbler_test.go b/nibbler_test.go index 399bf66..3b93c93 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -160,9 +160,9 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, - Processor: func(_ context.Context, _ Trigger, _ []string) error { //nolint:typecheck + Processor: func(_ context.Context, _ Trigger, _ []string) error { panic(errProcessing) - }, + }, //nolint ProcessorErr: func(failedBatch []string, err error) { asserter.ErrorIs(err, errProcessing) asserter.ElementsMatch([]string{"hello"}, failedBatch) From 9de3892b7e6d4098a634b919958ef975d04effaf Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:25:31 +0100 Subject: [PATCH 10/13] nolint --- nibbler_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nibbler_test.go b/nibbler_test.go index 3b93c93..bb0f7e4 100644 --- a/nibbler_test.go +++ b/nibbler_test.go @@ -161,8 +161,13 @@ func TestProcessorErr(tt *testing.T) { nib, err := Start(&Config[string]{ TickerDuration: time.Second, Processor: func(_ context.Context, _ Trigger, _ []string) error { - panic(errProcessing) - }, //nolint + // 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) asserter.ElementsMatch([]string{"hello"}, failedBatch) From e2600f1c588630fe86b530f8b91829c10e87e55b Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:30:11 +0100 Subject: [PATCH 11/13] nolint --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2faae21..f8d616c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,4 +40,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v6 with: - version: v1.60 + version: v2.60 From f6a44bda622073503afd859e7312ddcda259f0fe Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:32:10 +0100 Subject: [PATCH 12/13] nolint --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f8d616c..3e714ba 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.24" + 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: v2.60 From 3dfebb029b3d6aed4704ad8380ca04c56f333591 Mon Sep 17 00:00:00 2001 From: Kamaleshwar Date: Mon, 17 Nov 2025 17:34:16 +0100 Subject: [PATCH 13/13] nolint --- .github/workflows/go.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 3e714ba..7a24022 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,4 +40,4 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v7 with: - version: v2.60 + version: v2.6