Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Commit

Permalink
Don't log a warning when creating a new flag in redis feature store. (#…
Browse files Browse the repository at this point in the history
…38)

Only log a warning when Get shows a missing flag.
  • Loading branch information
ashanbrown authored Jan 31, 2018
1 parent 97d7a75 commit 33e575c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ package ldclient
import (
"encoding/json"
"fmt"
r "github.com/garyburd/redigo/redis"
"github.com/patrickmn/go-cache"
"log"
"os"
"time"
"reflect"
"sync"
"time"

r "github.com/garyburd/redigo/redis"
"github.com/patrickmn/go-cache"
)

// A Redis-backed feature store.
Expand Down Expand Up @@ -113,9 +114,12 @@ func (store *RedisFeatureStore) featuresKey() string {

func (store *RedisFeatureStore) Get(key string) (*FeatureFlag, error) {
feature, err := store.getEvenIfDeleted(key)
if err == nil && feature == nil {
store.logger.Printf("RedisFeatureStore: WARN: Feature flag not found in store. Key: %s", key)
}
if err == nil && feature != nil && feature.Deleted {
store.logger.Printf("RedisFeatureStore: WARN: Attempted to get deleted feature flag. Key: %s", key)
return nil, nil
return nil, nil
}
return feature, err
}
Expand Down Expand Up @@ -260,7 +264,6 @@ func (store *RedisFeatureStore) getEvenIfDeleted(key string) (*FeatureFlag, erro

if err != nil {
if err == r.ErrNil {
store.logger.Printf("RedisFeatureStore: WARN: Feature flag not found in store. Key: %s", key)
return nil, nil
}
return nil, err
Expand Down

0 comments on commit 33e575c

Please sign in to comment.