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 7ca28c9 commit f902454
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/election.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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
5 changes: 1 addition & 4 deletions pkg/controller/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ package controller
import (
"context"
"fmt"
"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"
"strings"

kubeovnv1 "github.com/kubeovn/kube-ovn/pkg/apis/kubeovn/v1"
"github.com/kubeovn/kube-ovn/pkg/ovs"
Expand Down Expand Up @@ -219,7 +217,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 f902454

Please sign in to comment.