-
Notifications
You must be signed in to change notification settings - Fork 9
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: synchronize provider registration #136
fix: synchronize provider registration #136
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #136 +/- ##
=======================================
Coverage 99.53% 99.54%
=======================================
Files 16 16
Lines 214 218 +4
=======================================
+ Hits 213 217 +4
Misses 1 1 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Manuel Schönlaub <[email protected]>
f5de21f
to
f5dc47d
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.
I haven't worked with threading a ton in Ruby, so maybe @technicalpickles or @josecolella have any thoughts here. This makes sense to me. I'm curious if there was a reproduction case you encountered while using the SDK that impacted thread safety, or if this is an anticipated issue with setting providers on the singleton (I can see the reason why multiple threads would potentially overlap here).
Unfortunately, there's still a bit of stuff to do before we can think of actually using this in production. So it's not a full repro case. I do think that a very basic usage in a, let's say One thing with ruby (actually only the MRI) is that it's a bit hard to see concurrency issues. Because of the GIL there's only a handful of situations where you have context switches, like blocking IO. IMHO the minimal part of the API that would need to be threadsafe would be the global API and Clients. I'd be very interested in your take on this, though. I might be highly biased though, because I'm really coming from the |
Yes, this is primarily why I don't have experience with it; I just haven't encountered that many Ruby projects that use concurrency. I do think it's worthwhile to start thinking about/working on this. I think tackling concurrency in the context of a multi-threaded app (i.e. |
This PR
Notes
This likely does not do enough to really make it "threadsafe". It's good enough for the obvious case i stumbled across and should be fine for MRI support.
Follow-up Tasks
Define whether at this stage we want to support "truly parallel" ruby implementations.