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

retry: refactor stop channel/WaitGroup usage to reduce dependency on WatchFactory #3297

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

dcbw
Copy link
Contributor

@dcbw dcbw commented Dec 1, 2022

Instead of having the WatchFactory expose a WaitGroup (which is somewhat of an encapsulation violation), we can pass the top-level WaitGroup from ovnkube.go down to the retry code and use it there. We're already using that WaitGroup many places in the master and node code so we might as well push it down to retry code too. This keeps the factory code somewhat cleaner by not exposing its own internal WaitGroup.

All we really care about is that the goroutine that calls periodicallyRetryResources() exits when the OvnController or OvnNode is shut down, and adding it to the top-level WaitGroup accomplishes that.

As a bonus, consolidate FakeOvnNode shutdown code in the node tests into AfterEach().

@trozet @npinaeva @bpickard22

Reverts part of #3226

…WatchFactory

Instead of having the WatchFactory expose a waitgroup, pass the top-level
waitgroup down to the retry code and use it there. The WatchFactory
already waits for all handlers to stop, so we don't need to couple
both things together.

Signed-off-by: Dan Williams <dcbw@redhat.com>
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 53.528% when pulling 8e5a605 on dcbw:retry-wait-refactor into 2e6e321 on ovn-org:master.

Copy link
Contributor

@bpickard22 bpickard22 left a comment

Choose a reason for hiding this comment

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

/lgtm this is a much better way to fix the race than having the watcher have its own wg.

@dcbw dcbw merged commit 019e52c into ovn-org:master Dec 1, 2022
dcbw added a commit to dcbw/ovn-kubernetes-1 that referenced this pull request Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants