Skip to content

Commit d63d10a

Browse files
committed
backend: fix SaveMatchExists returning redis.Nil as error
1 parent 8de305d commit d63d10a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

backend/internal/redis/matches.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@ package redis
22

33
import (
44
"context"
5+
"errors"
56
"strconv"
67
"time"
8+
9+
"github.com/redis/go-redis/v9"
710
)
811

912
func (r Client) SaveMatchExists(ctx context.Context, matchID int) error {
10-
return r.client.Set(ctx, strconv.Itoa(matchID), 1, 7*24*time.Hour).Err()
13+
err := r.client.Set(ctx, strconv.Itoa(matchID), 1, 7*24*time.Hour).Err()
14+
if errors.Is(err, redis.Nil) {
15+
return nil
16+
}
17+
18+
return err
1119
}
1220

1321
func (r Client) MatchExists(ctx context.Context, matchID int) (bool, error) {

0 commit comments

Comments
 (0)