From c0d7cf00011547c81e40b00814ba62ff25632c39 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Tue, 17 Dec 2013 18:02:54 +0200 Subject: [PATCH] small fixes --- engine/destinations.go | 4 ++-- engine/storage_redis.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/destinations.go b/engine/destinations.go index 68941e28b..5c73a81f4 100644 --- a/engine/destinations.go +++ b/engine/destinations.go @@ -50,9 +50,9 @@ func (d *Destination) containsPrefix(prefix string) int { } } if d.longPrefixesMap != nil { - for i, p := range utils.SplitPrefix(prefix) { + for _, p := range utils.SplitPrefix(prefix) { if _, found := d.longPrefixesMap[p]; found { - return len(prefix) - i + return len(p) } } } diff --git a/engine/storage_redis.go b/engine/storage_redis.go index edc05d198..359f5a9a0 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -253,6 +253,8 @@ func (rs *RedisStorage) GetDestination(key string, checkDb bool) (dest *Destinat } dest.OptimizePrefixes() cache2go.Cache(key, dest) + } else { + return nil, errors.New("not found") } return }