Skip to content

Commit

Permalink
Improve cache error type (#4796)
Browse files Browse the repository at this point in the history
  • Loading branch information
yycptt authored Aug 24, 2023
1 parent 080710d commit 4430add
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions common/cache/lru.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ package cache

import (
"container/list"
"errors"
"sync"
"time"

enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/api/serviceerror"
"go.temporal.io/server/common/clock"
)

var (
// ErrCacheFull is returned if Put fails due to cache being filled with pinned elements
ErrCacheFull = errors.New("cache capacity is fully occupied with pinned elements")
ErrCacheFull = serviceerror.NewResourceExhausted(
enumspb.RESOURCE_EXHAUSTED_CAUSE_SYSTEM_OVERLOADED,
"cache capacity is fully occupied with pinned elements",
)
// ErrCacheItemTooLarge is returned if Put fails due to item size being larger than max cache capacity
ErrCacheItemTooLarge = errors.New("cache item size is larger than max cache capacity")
ErrCacheItemTooLarge = serviceerror.NewInternal("cache item size is larger than max cache capacity")
)

const emptyEntrySize = 0
Expand Down

0 comments on commit 4430add

Please sign in to comment.