Skip to content

Commit f4f04ce

Browse files
committed
Bugfix
1 parent 7f48c09 commit f4f04ce

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pkg/agent/clientset.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ func (cs *ClientSet) resetBackoff() *wait.Backoff {
185185
}
186186

187187
// sync makes sure that #clients >= #proxy servers
188-
func (cs *ClientSet) sync(ctx context.Context) {
188+
func (cs *ClientSet) sync() {
189189
defer cs.shutdown()
190190
backoff := cs.resetBackoff()
191191
var duration time.Duration
192192
for {
193-
if serverCount, err := cs.connectOnce(ctx); err != nil {
193+
if serverCount, err := cs.connectOnce(); err != nil {
194194
if dse, ok := err.(*DuplicateServerError); ok {
195195
clientsCount := cs.ClientsCount()
196196
klog.V(4).InfoS("duplicate server", "serverID", dse.ServerID, "serverCount", serverCount, "clientsCount", clientsCount)
@@ -217,10 +217,10 @@ func (cs *ClientSet) sync(ctx context.Context) {
217217
}
218218
}
219219

220-
func (cs *ClientSet) ServerCount(ctx context.Context) int {
220+
func (cs *ClientSet) ServerCount() int {
221221
var serverCount int
222222
if cs.leaseCounter != nil {
223-
serverCount = cs.leaseCounter.Count(ctx)
223+
serverCount = cs.leaseCounter.Count()
224224
} else {
225225
serverCount = cs.lastReceivedServerCount
226226
}
@@ -234,8 +234,8 @@ func (cs *ClientSet) ServerCount(ctx context.Context) int {
234234
return serverCount
235235
}
236236

237-
func (cs *ClientSet) connectOnce(ctx context.Context) (int, error) {
238-
serverCount := cs.ServerCount(ctx)
237+
func (cs *ClientSet) connectOnce() (int, error) {
238+
serverCount := cs.ServerCount()
239239

240240
if !cs.syncForever && serverCount != 0 && cs.ClientsCount() >= serverCount {
241241
return serverCount, nil
@@ -265,7 +265,7 @@ func (cs *ClientSet) Serve() {
265265
"agentIdentifiers", cs.agentIdentifiers,
266266
"serverAddress", cs.address,
267267
)
268-
go runpprof.Do(context.Background(), labels, func(ctx context.Context) { cs.sync(ctx) })
268+
go runpprof.Do(context.Background(), labels, func(ctx context.Context) { cs.sync() })
269269
}
270270

271271
func (cs *ClientSet) shutdown() {

0 commit comments

Comments
 (0)