-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix(upgrade-job): wait for event worker to exit for errors #319
Conversation
c8aa732
to
f22401d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if waiting on a drop is a good practice...
Could we achieve the same some other way?
Sure, could you suggest a suitable pattern for fleshing out this destructor-like tool. |
What about just waiting for the work to complete in |
So, no change? |
Closing this as this refactor is not needed. |
Just noticed that shutdown worker doesn't guarantee publish of error events. Only guarantees publish of successful upgrade. I think this is still required. What might be a good alternative to the drop thing, @tiagolobocastro ? |
f22401d
to
9c26cdf
Compare
9c26cdf
to
5bc16fe
Compare
Updated code in this PR to not use the EventRecorder's Drop. Instead it moves the event recorder to one level up in the calling sequence. This let's the event recorder's shutdown_worker method wait for the loop to exit. |
5090581
to
17a1023
Compare
Signed-off-by: Niladri Halder <niladri.halder26@gmail.com>
17a1023
to
1ebfa87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested & LGTM
bors merge |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
The upgrade job main thread starts a worker thread which listens for events and publishes them (as kubernetes events). When the upgrade method exits, the 'EventRecorder' instance for it is dropped. This in turn drops the event channel (used to pass events to the event worker) and also the handle to event worker. The event worker does not have enough time after the channel is dropped, to publish its events and exit.
This PR defers all of the event publishes and actual upgrade steps to an inner function. The caller of this function makes sure the event loop exits before returning.