Skip to content

Commit bba3036

Browse files
zipzap11Francisco
and
Francisco
authored
hotfix: fix get multi hashmembers (#47)
* hotfix: return slice of nil replies on disable cache --------- Co-authored-by: Francisco <francisco.francisco@kumparan.com>
1 parent 1ea9363 commit bba3036

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

keeper.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,15 @@ func (k *keeper) GetHashMember(ctx context.Context, identifier string, key strin
638638
// GetMultiHashMembers return type is *goredis.StringCmd
639639
// to reduce looping and casting, so the caller is the one that should cast it
640640
func (k *keeper) GetMultiHashMembers(ctx context.Context, hashMember []HashMember) (replies []interface{}, err error) {
641-
if k.disableCaching || len(hashMember) == 0 {
642-
return
641+
if len(hashMember) == 0 {
642+
return nil, nil
643+
}
644+
if k.disableCaching {
645+
var replies []interface{}
646+
for range hashMember {
647+
replies = append(replies, goredis.NewStringResult("", goredis.Nil))
648+
}
649+
return replies, nil
643650
}
644651

645652
pipe := k.connPool.Pipeline()

0 commit comments

Comments
 (0)