From 65804801ecf95eef88c5ee418693e2e08b27509c Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Thu, 5 Aug 2021 14:07:45 +0300 Subject: [PATCH] all: fix mon.Task leak Change-Id: Ifd58c7ac5631b9c3c750b3f4cc50525167e90709 --- certificate/authorization/endpoint.go | 2 +- satellite/overlay/service.go | 2 +- satellite/satellitedb/overlaycache.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/certificate/authorization/endpoint.go b/certificate/authorization/endpoint.go index 648d75c17..a455ed801 100644 --- a/certificate/authorization/endpoint.go +++ b/certificate/authorization/endpoint.go @@ -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) diff --git a/satellite/overlay/service.go b/satellite/overlay/service.go index 04afbd9ea..6e97f6ac4 100644 --- a/satellite/overlay/service.go +++ b/satellite/overlay/service.go @@ -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) } diff --git a/satellite/satellitedb/overlaycache.go b/satellite/satellitedb/overlaycache.go index 8fb32a87d..9a3593c4f 100644 --- a/satellite/satellitedb/overlaycache.go +++ b/satellite/satellitedb/overlaycache.go @@ -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")