Skip to content

Commit

Permalink
Hide memory limit is reached error (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-scherbina authored Nov 6, 2023
1 parent 43a4579 commit cd67a69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion service/cachemdw/caching_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"io"
"net/http"
"strings"

"github.com/kava-labs/kava-proxy-service/decode"
"github.com/kava-labs/kava-proxy-service/logging"
Expand Down Expand Up @@ -52,12 +53,13 @@ func (c *ServiceCache) CachingMiddleware(
// if request isn't already cached, request is cacheable and response is present in context - cache the response
if !isCached && cacheable && ok {
headersToCache := getHeadersToCache(w, c.whitelistedHeaders)
memoryLimitIsReachedError := "OOM command not allowed when used memory > 'maxmemory'"
if err := c.CacheQueryResponse(
r.Context(),
decodedReq,
typedResponse,
headersToCache,
); err != nil {
); err != nil && !strings.Contains(err.Error(), memoryLimitIsReachedError) {
c.Logger.Error().Msgf("can't validate and cache response: %v", err)
}
}
Expand Down

0 comments on commit cd67a69

Please sign in to comment.