From 1f19b64f9eb81044a70820b30b66d31299a08cc7 Mon Sep 17 00:00:00 2001 From: Vojtech Vitek Date: Thu, 8 Aug 2024 16:58:36 +0200 Subject: [PATCH] Update Redis in CI, lower #no of connections --- .github/workflows/ci.yml | 2 +- httprateredis_test.go | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0afc611..57c8df2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: services: redis: - image: redis:6 + image: redis:7 ports: - 6379:6379 diff --git a/httprateredis_test.go b/httprateredis_test.go index a6b4820..58d542f 100644 --- a/httprateredis_test.go +++ b/httprateredis_test.go @@ -15,8 +15,8 @@ func TestRedisCounter(t *testing.T) { limitCounter, err := httprateredis.NewRedisLimitCounter(&httprateredis.Config{ Host: "localhost", Port: 6379, - MaxIdle: 100, - MaxActive: 200, + MaxIdle: 0, + MaxActive: 2, DBIndex: 0, ClientName: "httprateredis_test", PrefixKey: fmt.Sprintf("httprate:test:%v", rand.Int31n(100000)), // Unique Redis key for each test @@ -162,7 +162,10 @@ func BenchmarkLocalCounter(b *testing.B) { DBIndex: 0, ClientName: "httprateredis_test", PrefixKey: fmt.Sprintf("httprate:test:%v", rand.Int31n(100000)), // Unique key for each test + MaxActive: 1, + MaxIdle: 0, FallbackDisabled: true, + FallbackTimeout: 5 * time.Second, }) if err != nil { b.Fatalf("redis not available: %v", err)