influitive / apartment

Database multi-tenancy for Rack (and Rails) applications
2.67k stars 463 forks source link

Apartment Thread safe? #560

Closed TengZhangAutoGrid closed 6 years ago

TengZhangAutoGrid commented 6 years ago

Sorry for creating this issue. I don't know where else can I ask. So, I'll leave my question here.

Recently, we started a new project using puma. According to our need, we have to make it support multi-tenancy. But, again, we have to make sure it's thread safe.

Here's a old solution: http://railscasts.com/episodes/388-multitenancy-with-scopes But, I think it's not thread safe because it uses class variable. (Correct me if I'm wrong.)

And, then, we found Apartment. But, after some research on this, I still can't figure out if it's really thread safe and compatible with puma.

Can you please give me a official answer of Is Apartment thread safe? Thank you so much!

My Environment:

mikecmpbll commented 6 years ago

it's currently "thread safe" with use_schemas=true and MySQL.