Skip to content

Commit

Permalink
feat: change error log to warn log when cache miss
Browse files Browse the repository at this point in the history
Signed-off-by: Gaius <[email protected]>
  • Loading branch information
gaius-qi committed Mar 31, 2023
1 parent cbf0b38 commit d981fd0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions manager/rpcserver/manager_server_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (s *managerServerV1) GetSeedPeer(ctx context.Context, req *managerv1.GetSee
// Cache hit.
var pbSeedPeer managerv1.SeedPeer
if err := s.cache.Get(ctx, cacheKey, &pbSeedPeer); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbSeedPeer, nil
Expand Down Expand Up @@ -262,7 +262,7 @@ func (s *managerServerV1) GetScheduler(ctx context.Context, req *managerv1.GetSc
// Cache hit.
var pbScheduler managerv1.Scheduler
if err := s.cache.Get(ctx, cacheKey, &pbScheduler); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbScheduler, nil
Expand Down Expand Up @@ -457,7 +457,7 @@ func (s *managerServerV1) ListSchedulers(ctx context.Context, req *managerv1.Lis
cacheKey := cache.MakeSchedulersCacheKeyForPeer(req.Hostname, req.Ip)

if err := s.cache.Get(ctx, cacheKey, &pbListSchedulersResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListSchedulersResponse, nil
Expand Down Expand Up @@ -576,7 +576,7 @@ func (s *managerServerV1) ListBuckets(ctx context.Context, req *managerv1.ListBu

// Cache hit.
if err := s.cache.Get(ctx, cacheKey, &pbListBucketsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListBucketsResponse, nil
Expand Down Expand Up @@ -616,7 +616,7 @@ func (s *managerServerV1) ListApplications(ctx context.Context, req *managerv1.L
var pbListApplicationsResponse managerv1.ListApplicationsResponse
cacheKey := cache.MakeApplicationsCacheKey()
if err := s.cache.Get(ctx, cacheKey, &pbListApplicationsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListApplicationsResponse, nil
Expand Down
10 changes: 5 additions & 5 deletions manager/rpcserver/manager_server_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (s *managerServerV2) GetSeedPeer(ctx context.Context, req *managerv2.GetSee
// Cache hit.
var pbSeedPeer managerv2.SeedPeer
if err := s.cache.Get(ctx, cacheKey, &pbSeedPeer); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbSeedPeer, nil
Expand Down Expand Up @@ -262,7 +262,7 @@ func (s *managerServerV2) GetScheduler(ctx context.Context, req *managerv2.GetSc
// Cache hit.
var pbScheduler managerv2.Scheduler
if err := s.cache.Get(ctx, cacheKey, &pbScheduler); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbScheduler, nil
Expand Down Expand Up @@ -457,7 +457,7 @@ func (s *managerServerV2) ListSchedulers(ctx context.Context, req *managerv2.Lis
cacheKey := cache.MakeSchedulersCacheKeyForPeer(req.Hostname, req.Ip)

if err := s.cache.Get(ctx, cacheKey, &pbListSchedulersResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListSchedulersResponse, nil
Expand Down Expand Up @@ -575,7 +575,7 @@ func (s *managerServerV2) ListBuckets(ctx context.Context, req *managerv2.ListBu

// Cache hit.
if err := s.cache.Get(ctx, cacheKey, &pbListBucketsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListBucketsResponse, nil
Expand Down Expand Up @@ -615,7 +615,7 @@ func (s *managerServerV2) ListApplications(ctx context.Context, req *managerv2.L
var pbListApplicationsResponse managerv2.ListApplicationsResponse
cacheKey := cache.MakeApplicationsCacheKey()
if err := s.cache.Get(ctx, cacheKey, &pbListApplicationsResponse); err != nil {
log.Errorf("%s cache miss because of %s", cacheKey, err.Error())
log.Warnf("%s cache miss because of %s", cacheKey, err.Error())
} else {
log.Debugf("%s cache hit", cacheKey)
return &pbListApplicationsResponse, nil
Expand Down

0 comments on commit d981fd0

Please sign in to comment.