From db8aa90321ff4611f7a16e633feeb4701dd57963 Mon Sep 17 00:00:00 2001 From: Roberto Bonafiglia Date: Mon, 18 Sep 2023 15:06:12 +0200 Subject: [PATCH] Revert "fix: goroutine leak during watch leases (kube)" --- pkg/subnet/etcd/subnet_test.go | 2 +- pkg/subnet/kube/kube.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/subnet/etcd/subnet_test.go b/pkg/subnet/etcd/subnet_test.go index 4c5084aed..02d2d9343 100644 --- a/pkg/subnet/etcd/subnet_test.go +++ b/pkg/subnet/etcd/subnet_test.go @@ -440,7 +440,7 @@ func TestRenewLease(t *testing.T) { t.Fatal("RenewLease failed: ", err) } //we expect the new lease to have an expiration date in exactly 24h - acceptableMargin := 10 * time.Second + acceptableMargin := 5 * time.Second expectedExpiration := time.Now().Add(subnetTTL).Round(time.Duration(acceptableMargin)) etcdResp, err := kvApi.Get(ctx, "/coreos.com/network/subnets", etcd.WithPrefix()) diff --git a/pkg/subnet/kube/kube.go b/pkg/subnet/kube/kube.go index 019b3daf6..4d8dad237 100644 --- a/pkg/subnet/kube/kube.go +++ b/pkg/subnet/kube/kube.go @@ -480,8 +480,7 @@ func (ksm *kubeSubnetManager) WatchLeases(ctx context.Context, receiver chan []l Events: []lease.Event{event}, }} case <-ctx.Done(): - close(receiver) - return ctx.Err() + return context.Canceled } } }