Merge pull request #87393 from MikeSpreitzer/remove-unused-loop

remove unused layer of loop structure in processorListener::run

Kubernetes-commit: 94ea2be3ccf5defdde7a340678e50ace410470ce
This commit is contained in:
Kubernetes Publisher 2020-01-24 19:21:28 -08:00
commit 996f3529d3
4 changed files with 18 additions and 27 deletions

2
Godeps/Godeps.json generated
View File

@ -352,7 +352,7 @@
}, },
{ {
"ImportPath": "k8s.io/apimachinery", "ImportPath": "k8s.io/apimachinery",
"Rev": "954b62493c18" "Rev": "656274101191"
}, },
{ {
"ImportPath": "k8s.io/gengo", "ImportPath": "k8s.io/gengo",

4
go.mod
View File

@ -29,7 +29,7 @@ require (
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
google.golang.org/appengine v1.5.0 // indirect google.golang.org/appengine v1.5.0 // indirect
k8s.io/api v0.0.0-20200124032216-924612ff3bca k8s.io/api v0.0.0-20200124032216-924612ff3bca
k8s.io/apimachinery v0.0.0-20200124032037-954b62493c18 k8s.io/apimachinery v0.0.0-20200125072041-656274101191
k8s.io/klog v1.0.0 k8s.io/klog v1.0.0
k8s.io/utils v0.0.0-20191217005138-9e5e9d854fcc k8s.io/utils v0.0.0-20191217005138-9e5e9d854fcc
sigs.k8s.io/yaml v1.1.0 sigs.k8s.io/yaml v1.1.0
@ -39,5 +39,5 @@ replace (
golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13 golang.org/x/sys => golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // pinned to release-branch.go1.13
golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13 golang.org/x/tools => golang.org/x/tools v0.0.0-20190821162956-65e3620a7ae7 // pinned to release-branch.go1.13
k8s.io/api => k8s.io/api v0.0.0-20200124032216-924612ff3bca k8s.io/api => k8s.io/api v0.0.0-20200124032216-924612ff3bca
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200124032037-954b62493c18 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20200125072041-656274101191
) )

2
go.sum
View File

@ -189,7 +189,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20200124032216-924612ff3bca/go.mod h1:WYGNSV/2aSDAMvHS6cmemi/htNIV58hkcMDRVUi/6tw= k8s.io/api v0.0.0-20200124032216-924612ff3bca/go.mod h1:WYGNSV/2aSDAMvHS6cmemi/htNIV58hkcMDRVUi/6tw=
k8s.io/apimachinery v0.0.0-20200124032037-954b62493c18/go.mod h1:OAtNFcsmF2+2JlejTQ9O5Qu7PHEA9GlSn28VjH8ssNs= k8s.io/apimachinery v0.0.0-20200125072041-656274101191/go.mod h1:OAtNFcsmF2+2JlejTQ9O5Qu7PHEA9GlSn28VjH8ssNs=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=

View File

@ -25,7 +25,6 @@ import (
"k8s.io/apimachinery/pkg/util/clock" "k8s.io/apimachinery/pkg/util/clock"
utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/retry"
"k8s.io/utils/buffer" "k8s.io/utils/buffer"
"k8s.io/klog" "k8s.io/klog"
@ -700,13 +699,11 @@ func (p *processorListener) pop() {
func (p *processorListener) run() { func (p *processorListener) run() {
// this call blocks until the channel is closed. When a panic happens during the notification // this call blocks until the channel is closed. When a panic happens during the notification
// we will catch it, **the offending item will be skipped!**, and after a short delay (one minute) // we will catch it, **the offending item will be skipped!**, and after a short delay (one second)
// the next notification will be attempted. This is usually better than the alternative of never // the next notification will be attempted. This is usually better than the alternative of never
// delivering again. // delivering again.
stopCh := make(chan struct{}) stopCh := make(chan struct{})
wait.Until(func() { wait.Until(func() {
// this gives us a few quick retries before a long pause and then a few more quick retries
err := wait.ExponentialBackoff(retry.DefaultRetry, func() (bool, error) {
for next := range p.nextCh { for next := range p.nextCh {
switch notification := next.(type) { switch notification := next.(type) {
case updateNotification: case updateNotification:
@ -720,14 +717,8 @@ func (p *processorListener) run() {
} }
} }
// the only way to get here is if the p.nextCh is empty and closed // the only way to get here is if the p.nextCh is empty and closed
return true, nil
})
// the only way to get here is if the p.nextCh is empty and closed
if err == nil {
close(stopCh) close(stopCh)
} }, 1*time.Second, stopCh)
}, 1*time.Minute, stopCh)
} }
// shouldResync deterimines if the listener needs a resync. If the listener's resyncPeriod is 0, // shouldResync deterimines if the listener needs a resync. If the listener's resyncPeriod is 0,