Skip to content

Commit 1ea7262

Browse files
committed
revert lostcancel analyzer
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
1 parent 3d0d6d0 commit 1ea7262

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

backend/provider/kcp/provider.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ type awareWrapper struct {
8383
}
8484

8585
func (a *awareWrapper) Engage(ctx context.Context, name multicluster.ClusterName, cluster cluster.Cluster) error {
86-
ctx, cancel := context.WithCancel(ctx)
87-
defer cancel()
86+
ctx, cancel := context.WithCancel(ctx) //nolint:govet // cancel is called in the error case only.
8887

8988
err := a.Aware.Engage(ctx, name, cluster)
9089
if err != nil {
90+
cancel()
9191
return err
9292
}
9393

@@ -108,6 +108,7 @@ func (a *awareWrapper) Engage(ctx context.Context, name multicluster.ClusterName
108108
}
109109

110110
if !apierrors.IsForbidden(err) {
111+
cancel()
111112
return err
112113
}
113114

@@ -116,15 +117,18 @@ func (a *awareWrapper) Engage(ctx context.Context, name multicluster.ClusterName
116117
select {
117118
case <-time.After(backoff):
118119
case <-ctx.Done():
120+
cancel()
119121
return ctx.Err()
120122
}
121123
}
122124
}
123125

124126
if err != nil && !apierrors.IsAlreadyExists(err) {
127+
cancel()
125128
return err
126129
}
127-
return nil
130+
131+
return nil //nolint:govet // cancel is called in the error case only.
128132
}
129133

130134
// NewKCPExternalAddressGenerator returns an ExternalAddressGeneratorFunc

0 commit comments

Comments
 (0)