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

Ensure events send out after being forked #50

Merged
merged 6 commits into from
May 14, 2014
Merged

Conversation

travisjeffery
Copy link
Contributor

This ensures that the threads that the event requests are on run after their process has been forked.

For people using forking servers like unicorn and passenger, they no longer have to setup the sdk again with:


check_write_key!

at_exit do
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we still need this so the thread gets properly GC'd: #27

@calvinfo
Copy link
Contributor

niiiiiiice! :D this looks really sweet.

only concern that I have is if they do something like:

analytics.init('secret')
analytics.track(...)

== FORK ==

analytics.track(...)

since the thread might still be "alive" but not actually synced with the right "queue" properly when the memory is copied.

if that case works, lgtm!

travisjeffery added a commit that referenced this pull request May 14, 2014
Ensure events send out after being forked
@travisjeffery travisjeffery merged commit d6ae66f into master May 14, 2014
@travisjeffery travisjeffery deleted the fix-threads branch May 14, 2014 19:58
@jtippett
Copy link

So to clarify - does this mean unicorn, et al users no longer have to re-init analytics-ruby after forking?

@toothrot
Copy link

This is pretty amazing. You should blog about this solution. I think it's a great pattern for lots of background threading.

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.

4 participants