diff --git a/.github/workflows/test-memory.yml b/.github/workflows/test-memory.yml index 4081c93a..dc79b913 100644 --- a/.github/workflows/test-memory.yml +++ b/.github/workflows/test-memory.yml @@ -1,5 +1,5 @@ on: [push, pull_request] -name: Test +name: Memory Test jobs: Build: strategy: diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index bcec7959..8e9a9012 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -104,6 +104,9 @@ func (s *Storage) Get(key string) ([]byte, error) { item := s.acquireItem() if err := res.Err(); err != nil { + if err == mongo.ErrNoDocuments { + return nil, ErrNotExist + } return nil, err } if err := res.Decode(&item); err != nil { @@ -111,7 +114,7 @@ func (s *Storage) Get(key string) ([]byte, error) { } if !item.Expiration.IsZero() && item.Expiration.Unix() <= time.Now().Unix() { - return nil, nil + return nil, ErrNotExist } // // not safe? // res := item.Val