feat: slow threshold customizable in redis (#1187)

This commit is contained in:
Kevin Wan
2021-11-01 08:20:35 +08:00
committed by GitHub
parent 8be0f77d96
commit f13e6f1149
6 changed files with 48 additions and 54 deletions

View File

@@ -1073,6 +1073,12 @@ func TestRedisGeo(t *testing.T) {
})
}
func TestSetSlowThreshold(t *testing.T) {
assert.Equal(t, defaultSlowThreshold, slowThreshold.Load())
SetSlowThreshold(time.Second)
assert.Equal(t, time.Second, slowThreshold.Load())
}
func TestRedis_WithPass(t *testing.T) {
runOnRedis(t, func(client *Redis) {
err := New(client.Addr, WithPass("any")).Ping()
@@ -1115,7 +1121,7 @@ func runOnRedisTLS(t *testing.T, fn func(client *Redis)) {
client.Close()
}
}()
fn(New(s.Addr(), WithTLS(), WithSlowThreshold(defaultSlowThreshold/2)))
fn(New(s.Addr(), WithTLS()))
}
func badType() Option {