Skip to content

Commit

Permalink
fix: update based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed May 23, 2024
1 parent ed9c9c3 commit 6d9cdc6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions node/pkg/db/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func LRange(ctx context.Context, key string, start int64, end int64) ([]string,
rdbConn, err := GetRedisConn(ctx)
if err != nil {
log.Error().Err(err).Msg("Error getting redis connection")
return nil, err
}
return rdbConn.LRange(ctx, key, start, end).Result()
}
Expand All @@ -163,6 +164,7 @@ func LPush(ctx context.Context, key string, values ...any) error {
rdbConn, err := GetRedisConn(ctx)
if err != nil {
log.Error().Err(err).Msg("Error getting redis connection")
return err
}
return rdbConn.LPush(ctx, key, values...).Err()
}
Expand Down
5 changes: 3 additions & 2 deletions node/pkg/db/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"reflect"
"sort"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -425,7 +426,7 @@ func TestPopAll(t *testing.T) {

// Check if the list is empty after popping
result, err := Get(ctx, key)
if err == nil {
if err == nil || !strings.Contains(err.Error(), "Error getting list: redis: nil") {
t.Fatalf("Expected to have err")
}
if len(result) != 0 {
Expand Down Expand Up @@ -472,7 +473,7 @@ func TestPopAllObject(t *testing.T) {

// Check if the list is empty after popping
result, err := Get(ctx, key)
if err == nil {
if err == nil || !strings.Contains(err.Error(), "Error getting list: redis: nil") {
t.Fatalf("Expected to have err")
}
if len(result) != 0 {
Expand Down

0 comments on commit 6d9cdc6

Please sign in to comment.