Skip to content

Commit

Permalink
perf: reduce controller init time (#2054)
Browse files Browse the repository at this point in the history
Controller always sleeps 8 seconds before processing, reducing the sleep time.

(cherry picked from commit db4fd62)
  • Loading branch information
oilbeater committed Nov 21, 2022
1 parent ea80eb9 commit 2b3c1f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Controller) leaderElection() {
klog.Info("waiting for becoming a leader")
flag = true
}
time.Sleep(5 * time.Second)
time.Sleep(1 * time.Second)
}
}

Expand Down
7 changes: 2 additions & 5 deletions pkg/controller/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ package controller
import (
"context"
"fmt"
"net"
"strings"
"time"

corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"net"
"strings"

"github.com/kubeovn/kube-ovn/pkg/ovs"
"github.com/kubeovn/kube-ovn/pkg/util"
Expand Down Expand Up @@ -188,7 +186,6 @@ func (c *Controller) gcLogicalSwitchPort() error {
if err := c.markAndCleanLSP(); err != nil {
return err
}
time.Sleep(3 * time.Second)
return c.markAndCleanLSP()
}

Expand Down

0 comments on commit 2b3c1f4

Please sign in to comment.