Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Commit

Permalink
Don't set global resync period.
Browse files Browse the repository at this point in the history
By using the init() function, we were overriding the resync period for
all controllers whilst we only wanted this behaviour for the GitHub
Connector.

Moving it into the controller construct ensures that it's only called
when we call that constructor.
  • Loading branch information
jelmersnoeck committed Jun 5, 2018
1 parent a0220aa commit 960a442
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/githubrepository/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ import (
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
)

func init() {
// let's not hit rate limits
kubekit.ResyncPeriod = 30 * time.Second
}

// Controller will take care of syncing the internal status of the GitHub Policy
// object with the available releases on GitHub.
type Controller struct {
Expand Down Expand Up @@ -58,6 +53,11 @@ const authTokenKey = "GITHUB_AUTH_TOKEN"

// NewController returns a new GitHubRepository Controller.
func NewController(rcfg *rest.Config, cs kubernetes.Interface, namespace string, cfg Config) (*Controller, error) {
// Let's not hit rate limits.
// This is done here instead of an init function so we don't override the
// global settings for other controllers.
kubekit.ResyncPeriod = 30 * time.Second

rc, err := kubekit.RESTClient(rcfg, &v1alpha1.SchemeGroupVersion, v1alpha1.AddToScheme)
if err != nil {
return nil, err
Expand Down

0 comments on commit 960a442

Please sign in to comment.