GeezerVison is showing github.com — Gracefully shutdown background worker before the process exits by st0012 · Pull Request #1617 · getsentry/sentry-ruby
Conversation
st0012
commented
Nov 13, 2021
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Currently, when a process exits, SDK's background worker will discard all WIP sending tasks and cause lost of events. This is why we need to disable background worker in rake integration. And from the discussion in #1612, it seems to cause issues in the resque integration too.
Even though I want to avoid using the at_exit block, I don't think the responsibility of shutting down the background worker should fall on users. It should be handled by the SDK whenever possible. So in addition to providing a shutdown API in this PR, the SDK would also start the shutdown procedure when exiting the process.
Closes #1612
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging #1617 (d544a63) into master (bf37772) will decrease coverage by 2.37%.
The diff coverage is 76.92%.
❗ Current head d544a63 differs from pull request most recent head 84715a1. Consider uploading reports for the commit 84715a1 to get more accurate results

@@ Coverage Diff @@
## master #1617 +/- ##
==========================================
- Coverage 98.51% 96.13% -2.38%
==========================================
Files 133 107 -26
Lines 7394 6105 -1289
==========================================
- Hits 7284 5869 -1415
- Misses 110 236 +126
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf37772...84715a1. Read the comment docs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
rhcarvalho
changed the title
Gracefully shutdown background worker before the process exists
Gracefully shutdown background worker before the process exits
Nov 16, 2021
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.
very cool! I was just explaining this to support the other day why his test code wasn't working because the parent process died without flushing.
Thanks for adding!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
def execute(args=nil)
|
|
|
return super unless Sentry.initialized? && Sentry.get_current_hub
|
|
|
|
|
|
Sentry.get_current_hub.with_background_worker_disabled do
|
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.
Looking at execute here — isn't it just not doing anything in this form? Looks like it falls back to super in every branch, no? /cc @st0012
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
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.
|