Merge pull request #2335 from monkey92t/issue_2319

fix: hook.process.fn should return error instead of cmd.SetErr().
This commit is contained in:
Monkey 2022-12-29 19:22:29 +08:00 committed by GitHub
commit 5c486cf98a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
*.rdb *.rdb
testdata/*/ testdata/*
.idea/ .idea/

View File

@ -18,11 +18,12 @@ func (c *ClusterClient) DBSize(ctx context.Context) *IntCmd {
atomic.AddInt64(&size, n) atomic.AddInt64(&size, n)
return nil return nil
}) })
if err != nil { if err != nil {
cmd.SetErr(err) return err
} else {
cmd.val = size
} }
cmd.val = size
return nil return nil
}) })
return cmd return cmd
@ -46,10 +47,8 @@ func (c *ClusterClient) ScriptLoad(ctx context.Context, script string) *StringCm
return nil return nil
}) })
if err != nil {
cmd.SetErr(err) return err
}
return nil
}) })
return cmd return cmd
} }
@ -60,10 +59,8 @@ func (c *ClusterClient) ScriptFlush(ctx context.Context) *StatusCmd {
err := c.ForEachShard(ctx, func(ctx context.Context, shard *Client) error { err := c.ForEachShard(ctx, func(ctx context.Context, shard *Client) error {
return shard.ScriptFlush(ctx).Err() return shard.ScriptFlush(ctx).Err()
}) })
if err != nil {
cmd.SetErr(err) return err
}
return nil
}) })
return cmd return cmd
} }
@ -98,11 +95,12 @@ func (c *ClusterClient) ScriptExists(ctx context.Context, hashes ...string) *Boo
return nil return nil
}) })
if err != nil { if err != nil {
cmd.SetErr(err) return err
} else {
cmd.val = result
} }
cmd.val = result
return nil return nil
}) })
return cmd return cmd