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

thread safety #187

Open
ghost opened this issue Jul 31, 2020 · 4 comments
Open

thread safety #187

ghost opened this issue Jul 31, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Jul 31, 2020

I'm looking into using this library but I can't find any info on whether it's threadsafe or not? Thanks for any intel!

@PepperTeasdale
Copy link

Hey, just bumping this issue. Did you ever figure this out @mengelseatz ?

@ghost
Copy link
Author

ghost commented Nov 16, 2020

@PepperTeasdale I haven't and there were no replies. I'm assuming it's thread safe but haven't done a deep dive into the code yet.

@alex-kovshovik
Copy link

It looks like it might not be: we may have accidentally charged $X to one customer that was meant for another customer. And this is the reason I'm here. For some reason, we used an organizer with a few interactions to process the credit card charges. Each charge is processed as an individual Sidekiq job, and multiple jobs can be processed in parallel in the same Ruby process.

Every time I see calls like PayCharge.call(...) - this always raises a warning: "this is a class method call, need to be careful here"...

I wonder how context works interactors... is it thread-safe?

@gaffneyc
Copy link
Member

gaffneyc commented Jan 29, 2022

Yes, Interactor is thread safe in that you can call .call from multiple threads and each call generates a new context.

However, if you initialize an Interactor (i.e. call .new) then that instance is not thread safe and shouldn't be shared with multiple threads.

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

No branches or pull requests

3 participants