Skip to content

Commit

Permalink
net: fix redis ZAdd
Browse files Browse the repository at this point in the history
There was a breaking change to go-redis library redis/go-redis#2818

I've checked how it handles interface{} command arguments and it
converts int64 to string so this change should fix the problem.

Closes #2806

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Jan 2, 2024
1 parent 377b9e0 commit 416bfe7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -34,7 +34,7 @@ require (
github.com/opentracing/opentracing-go v1.2.0
github.com/prometheus/client_golang v1.17.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/redis/go-redis/v9 v9.3.0
github.com/redis/go-redis/v9 v9.3.1
github.com/sarslanhan/cronmask v0.0.0-20230801193303-54e29300a091
github.com/sirupsen/logrus v1.9.3
github.com/sony/gobreaker v0.5.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -356,6 +356,8 @@ github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5X
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/redis/go-redis/v9 v9.3.0 h1:RiVDjmig62jIWp7Kk4XVLs0hzV6pI3PyTnnL0cnn0u0=
github.com/redis/go-redis/v9 v9.3.0/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
github.com/redis/go-redis/v9 v9.3.1 h1:KqdY8U+3X6z+iACvumCNxnoluToB+9Me+TvyFa21Mds=
github.com/redis/go-redis/v9 v9.3.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
Expand Down
3 changes: 2 additions & 1 deletion net/redisclient.go
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"strconv"
"sync"
"time"

Expand Down Expand Up @@ -401,7 +402,7 @@ func (r *RedisRingClient) Set(ctx context.Context, key string, value interface{}
}

func (r *RedisRingClient) ZAdd(ctx context.Context, key string, val int64, score float64) (int64, error) {
res := r.ring.ZAdd(ctx, key, redis.Z{Member: val, Score: score})
res := r.ring.ZAdd(ctx, key, redis.Z{Member: strconv.FormatInt(val, 10), Score: score})
return res.Val(), res.Err()
}

Expand Down

0 comments on commit 416bfe7

Please sign in to comment.