From d490e9fd1dca980997068923aa6096276fd6d77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Lewandowski?= Date: Tue, 19 Nov 2024 09:51:00 +0100 Subject: [PATCH] chore(ARCO-283): check if key exists when counting records --- internal/cache/in_memory.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/cache/in_memory.go b/internal/cache/in_memory.go index 2140d3474..8f6b11113 100644 --- a/internal/cache/in_memory.go +++ b/internal/cache/in_memory.go @@ -129,6 +129,9 @@ func (s *MemoryStore) GetAllForHashAndDelete(hash string) (map[string][]byte, er func (s *MemoryStore) CountElementsForHash(hash string) (int64, error) { hashMap, err := s.GetAllForHash(hash) if err != nil { + if errors.Is(err, ErrCacheNotFound) { + return 0, nil + } return 0, err }