Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuring resync period in file informer factory #12

Closed
wants to merge 1 commit into from

Conversation

mayankshah1607
Copy link

Fixes #9

Signed-off-by: Mayank Shah [email protected]

@github-actions
Copy link

github-actions bot commented Sep 11, 2022

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@mayankshah1607
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@mayankshah1607
Copy link
Author

recheck

}

var _ dynamicinformer.DynamicSharedInformerFactory = &Factory{}

// NewFileInformerFactory creates a new Factory.
func NewFileInformerFactory(log logr.Logger) (*Factory, error) {
func NewFileInformerFactory(log logr.Logger, opts FactoryOpts) (*Factory, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we used functional options here, like:

type FactoryOptFunc func(*FactoryOpts)

func WithResyncPeriod(resync time.Duration) FactoryOptFunc {
   return func(opts *FactoryOpts) {
      opts.ResyncPeriod = resync
   }
}

func NewFileInformerFactory(log logr.Logger, ...opts FactoryOptFunc)

Then existing call sites would continue working, but you could also pass in a new interval if you needed to:

existingFactory := NewFileInformerFactory(logger)

customResync := NewFileInformerFactory(logger, WithResyncPeriod(5*time.Minute))

Copy link
Contributor

@ecordell ecordell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on! I left a comment with a design suggestion, and we should also make sure to update the examples / tests.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configurable resync period for FileInformer
2 participants