fix: hook.process.fn should return error instead of cmd.SetErr()

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
monkey92t 2022-12-29 17:04:57 +08:00
parent 52af8ba852
commit 0358ca4bfe
2 changed files with 13 additions and 15 deletions

2
.gitignore vendored
View File

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

View File

@ -18,11 +18,12 @@ func (c *ClusterClient) DBSize(ctx context.Context) *IntCmd {
atomic.AddInt64(&size, n)
return nil
})
if err != nil {
cmd.SetErr(err)
} else {
cmd.val = size
return err
}
cmd.val = size
return nil
})
return cmd
@ -46,10 +47,8 @@ func (c *ClusterClient) ScriptLoad(ctx context.Context, script string) *StringCm
return nil
})
if err != nil {
cmd.SetErr(err)
}
return nil
return err
})
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 {
return shard.ScriptFlush(ctx).Err()
})
if err != nil {
cmd.SetErr(err)
}
return nil
return err
})
return cmd
}
@ -98,11 +95,12 @@ func (c *ClusterClient) ScriptExists(ctx context.Context, hashes ...string) *Boo
return nil
})
if err != nil {
cmd.SetErr(err)
} else {
cmd.val = result
return err
}
cmd.val = result
return nil
})
return cmd