From 2abe2182dd850d209594b0a0a9508d68fae4fe55 Mon Sep 17 00:00:00 2001 From: MaineK00n Date: Tue, 25 Jun 2024 14:44:10 +0900 Subject: [PATCH] feat!(db/redis): remove backward compatibility code --- db/redis.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/db/redis.go b/db/redis.go index d3c34eb..9c29ddb 100644 --- a/db/redis.go +++ b/db/redis.go @@ -258,18 +258,11 @@ func (r *RedisDriver) GetSimilarCpesByTitle(query string, n int, algorithm edlib ctx := context.Background() var ts []string bs, err := r.conn.Get(ctx, titleListCacheKey).Bytes() - if err == nil { - if err := json.Unmarshal(bs, &ts); err != nil { - return nil, xerrors.Errorf("Failed to Unmarshal JSON. err: %w", err) - } - } else { - if !xerrors.Is(err, redis.Nil) { - return nil, xerrors.Errorf("Failed to Get Titles. err: %w", err) - } - ts, err = r.conn.SMembers(ctx, titleListKey).Result() - if err != nil { - return nil, xerrors.Errorf("Failed to SMembers Titles. err: %w", err) - } + if err != nil { + return nil, xerrors.Errorf("Failed to Get Titles. err: %w", err) + } + if err := json.Unmarshal(bs, &ts); err != nil { + return nil, xerrors.Errorf("Failed to Unmarshal JSON. err: %w", err) } if len(ts) < n {