Fix concurrent map access by using a synchronized map #348
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.
Fixes #216
Copy'ing the analysis from the issue here:
generic_replicator
uses it to register hook functions to be informed on namespace additions and updates.generic_replicator
also uses its own informer to be notified of changes to other resources.NamespaceAdded
hook as well as written from theResourceAdded
hook called by the other Informer.We switched to using a
sync.Map
forReplicateToList
andReplicateToMatchingList
.We did not change the
DependencyMap
, since it is only used in the resources informer hooks.We also created a simple test to see whether there is any noticeable change to the performance:
fake.NewClientset()
K8s clientWe did not see any change in the execution time. But of course this test may not be extensive, so any insights are appreciated.