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
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