Skip to content

Commit

Permalink
Merge pull request #1799 from iiiceoo/fix-wl-ctx
Browse files Browse the repository at this point in the history
fix: goroutine leak during watch leases (kube)
  • Loading branch information
manuelbuil committed Sep 18, 2023
2 parents 148b6d6 + 91bae36 commit 4d37aa7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/subnet/etcd/subnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := 5 * time.Second
acceptableMargin := 10 * time.Second
expectedExpiration := time.Now().Add(subnetTTL).Round(time.Duration(acceptableMargin))

etcdResp, err := kvApi.Get(ctx, "/coreos.com/network/subnets", etcd.WithPrefix())
Expand Down
3 changes: 2 additions & 1 deletion pkg/subnet/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ func (ksm *kubeSubnetManager) WatchLeases(ctx context.Context, receiver chan []l
Events: []lease.Event{event},
}}
case <-ctx.Done():
return context.Canceled
close(receiver)
return ctx.Err()
}
}
}
Expand Down

0 comments on commit 4d37aa7

Please sign in to comment.