fix(config): only call run if informer not already synced #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, reverst prints out a warning because informers are getting
Run()
called more than once.This is because the shared informer factory caches previously instantiated informers based in the object type (note for future thought, it doesn't take into consideration e.g. list options or namespace filter supplied).
The way the secret source works, it can and will request the same informer, so we will invoke Run on the same instance more than once when secrets are updated.
This change just interogates the informer returned by the factory to see if it has been synced at-least once.
We won't build another informer until we have at-least waited for a single sync, so I am leaning on this invariant to avoid calling Run more than once.
The other alternative is to effectively create our own factory and cache it manually, which we could do.
For now though, this appears to avoid the double Run situation.
p.s. I fixed the race on
t.Log
causing the occassional panic in tests.