all: fix mon.Task leak

Change-Id: Ifd58c7ac5631b9c3c750b3f4cc50525167e90709
This commit is contained in:
Egon Elbre 2021-08-05 14:07:45 +03:00
parent ae02f6deda
commit 65804801ec
3 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ func (endpoint *Endpoint) Close() error {
func (endpoint *Endpoint) handleAuthorization(writer http.ResponseWriter, httpReq *http.Request) {
var err error
ctx := httpReq.Context()
mon.Task()(&ctx)(&err)
defer mon.Task()(&ctx)(&err)
if httpReq.Method != http.MethodPut {
msg := fmt.Sprintf("unsupported HTTP method: %s", httpReq.Method)

View File

@ -460,7 +460,7 @@ func (service *Service) Reliable(ctx context.Context) (nodes storj.NodeIDList, e
// UpdateReputation updates the DB columns for any of the reputation fields.
func (service *Service) UpdateReputation(ctx context.Context, id storj.NodeID, request *ReputationStatus) (err error) {
mon.Task()(&ctx)(&err)
defer mon.Task()(&ctx)(&err)
return service.db.UpdateReputation(ctx, id, request)
}

View File

@ -496,7 +496,7 @@ func (cache *overlaycache) reliable(ctx context.Context, criteria *overlay.NodeC
// UpdateReputation updates the DB columns for any of the reputation fields in UpdateReputationRequest.
func (cache *overlaycache) UpdateReputation(ctx context.Context, id storj.NodeID, request *overlay.ReputationStatus) (err error) {
mon.Task()(&ctx)(&err)
defer mon.Task()(&ctx)(&err)
err = cache.db.WithTx(ctx, func(ctx context.Context, tx *dbx.Tx) (err error) {
_, err = tx.Tx.ExecContext(ctx, "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE")