Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor retry to close watchFactory
leverage stop channel on watch factory when periodic retry stopchannel is called Problem: Hybrid test was creating creating an ovn-controller for some tests. The tests could not use the waitGroup in the test so the afterEach function (cleanup function after each test) could execute while leaving controllers up. In the tests, we were leveraging the code in ovn.go to run the controllers and creating a watcher pod on them. This issue was just a symptom of the main issue which was that we were using the incorrect stopChannel in the retry logic. Solution: The stopChannel that we use in the watchFactory is private, so we created a function that when called will close the watcher stopChannel, closing the watcher. We then call this function in the select (basically a switch statement in go but for channels) to close the watcher, because when we stop watching an object, that means we no longer care about it and should stop retrying it. This also adds a public waitgroup property to the watchfactory that we are using to ensure that the retry loop has exited before we shutdown the watcher to avoid any races there Since we no longer use the stopChannel in the retryFramework, this also removes that stopChannel from the newRetryFramework function definition, and all its refrences (which at this time was just in obj_retry_master) Signed-off-by: Ben Pickard <bpickard@redhat.com> Closes: #3203 Remove stopChannel from retryFrameowork We no longer use the controller stopChannel passed to the retryFramework, as we use the watcher stopChannel, so we can remove it Signed-off-by: Ben Pickard <bpickard@redhat.com>
- Loading branch information