feat: migrate redis breaker into hook (#3982)

This commit is contained in:
MarkJoyMa
2024-03-12 12:21:33 +08:00
committed by GitHub
parent f372b98d96
commit 7d90f906f5
9 changed files with 1113 additions and 1462 deletions

View File

@@ -36,7 +36,7 @@ func (m myHook) ProcessHook(next red.ProcessHook) red.ProcessHook {
if cmd.Name() == "ping" && !m.includePing {
return next(ctx, cmd)
}
return errors.New("hook error")
return errors.New("durationHook error")
}
}
@@ -155,7 +155,7 @@ func TestRedis_NonBlock(t *testing.T) {
t.Run("nonBlock true", func(t *testing.T) {
s := miniredis.RunT(t)
// use hook to simulate redis ping error
// use durationHook to simulate redis ping error
_, err := NewRedis(RedisConf{
Host: s.Addr(),
NonBlock: true,