satellite/metainfo: Don't log error due to ctx cancellation
Context cancellation that aborts a non-essential Redis operation must not be logged as an error because the operation is intentionally canceled. We are actually considering them not to be an error in following operation because of the same reason and we return a RPC canceled status code. On the other hand it doesn't make sense to continue if the context is canceled because although this is a non-essential operation if this one is canceled due to the context the next one will be canceled for the same reason, hence, we return earlier. Change-Id: Ib3331975adeb06367d1ea0a578263ef50ae3f079
This commit is contained in:
parent
9c77c762cb
commit
aa1f50197a
@ -28,9 +28,7 @@ import (
|
||||
"storj.io/storj/satellite/metabase"
|
||||
)
|
||||
|
||||
var (
|
||||
ipRegexp = regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`)
|
||||
)
|
||||
var ipRegexp = regexp.MustCompile(`^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$`)
|
||||
|
||||
func getAPIKey(ctx context.Context, header *pb.RequestHeader) (key *macaroon.APIKey, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
@ -382,6 +380,10 @@ func (endpoint *Endpoint) addSegmentToUploadLimits(ctx context.Context, projectI
|
||||
|
||||
func (endpoint *Endpoint) addToUploadLimits(ctx context.Context, projectID uuid.UUID, size int64, segmentCount int64) error {
|
||||
if err := endpoint.projectUsage.AddProjectStorageUsage(ctx, projectID, size); err != nil {
|
||||
if errs2.IsCanceled(err) {
|
||||
return rpcstatus.Wrap(rpcstatus.Canceled, err)
|
||||
}
|
||||
|
||||
// log it and continue. it's most likely our own fault that we couldn't
|
||||
// track it, and the only thing that will be affected is our per-project
|
||||
// bandwidth and storage limits.
|
||||
|
Loading…
Reference in New Issue
Block a user