Skip to content

Commit 9c1e13b

Browse files
committed
Adjust timeout values
1 parent f6d8b1a commit 9c1e13b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

httprateredis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewRedisLimitCounter(cfg *Config) (*redisCounter, error) {
6767
ClientName: cfg.ClientName,
6868
DisableIndentity: true,
6969

70-
DialTimeout: cfg.FallbackTimeout,
70+
DialTimeout: 2 * cfg.FallbackTimeout,
7171
ReadTimeout: cfg.FallbackTimeout,
7272
WriteTimeout: cfg.FallbackTimeout,
7373
PoolSize: maxActive,

httprateredis_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ func TestRedisCounter(t *testing.T) {
1515
limitCounter, err := httprateredis.NewRedisLimitCounter(&httprateredis.Config{
1616
Host: "localhost",
1717
Port: 6379,
18-
MaxIdle: 500,
19-
MaxActive: 500,
18+
MaxIdle: 100,
19+
MaxActive: 200,
2020
DBIndex: 0,
2121
ClientName: "httprateredis_test",
22-
PrefixKey: fmt.Sprintf("httprate:test:%v", rand.Int31n(100000)), // Unique key for each test
22+
PrefixKey: fmt.Sprintf("httprate:test:%v", rand.Int31n(100000)), // Unique Redis key for each test
23+
FallbackTimeout: time.Second,
2324
FallbackDisabled: true,
2425
})
2526
if err != nil {
@@ -46,7 +47,7 @@ func TestRedisCounter(t *testing.T) {
4647
curr: 0,
4748
},
4849
{
49-
name: "t=0m: increment 1",
50+
name: "t=0m: increment by 1",
5051
incrBy: 1,
5152
prev: 0,
5253
curr: 1,

0 commit comments

Comments
 (0)