You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.
I see that you cannot nest the usage of ThreadSafe::Cache objects in version 0.3.5 of the gem because there is a single Mutex for all instances of ThreadSafe::Cache. Looking through the git history, I see that this issue has existed since at least 2012, so if you guys don't want to fix it, that makes total sense to me.
Here's a little ruby script that demonstrates the issue.
require'thread_safe'outer=ThreadSafe::Cache.newinner=ThreadSafe::Cache.newouter.compute("seven")dothree=inner.compute("three"){3}#blows up herethree + 4end
The place where the issue comes in for me is with using Rails.cache in conjunction with a ThreadSafe::Cache as the ActiveSupport::Cache seems to use one already under the hood. I'm using Rails v4.2.
I'm planning on switching to Concurrent::Map once I upgrade my project from concurrent-ruby 0.9.2 to 1.0.0 and I can monkey patch until then.
The text was updated successfully, but these errors were encountered:
I'm have mixed feelings. We've fixed this in concurrent-ruby so I's rather not release updates to thread_safe. OTOH since Rails 4 uses thread_safe we need to support it until most shops have updated to Rails 5--and that's going to take a long time.
If you don't mind using your monkey patch solution for now then I'd rather not release an update to thread_safe. But I'm happy to keep this issue open indefinitely. If other users start having trouble with this we can release an update later.
If you don't mind using your monkey patch solution for now then I'd rather
not release an update to thread_safe. But I'm happy to keep this issue open
indefinitely. If other users start having trouble with this we can release
an update later.
Will that work for you?
—
Reply to this email directly or view it on GitHub #24 (comment)
.
I see that you cannot nest the usage of
ThreadSafe::Cache
objects in version0.3.5
of the gem because there is a singleMutex
for all instances ofThreadSafe::Cache
. Looking through the git history, I see that this issue has existed since at least 2012, so if you guys don't want to fix it, that makes total sense to me.Here's a little ruby script that demonstrates the issue.
The place where the issue comes in for me is with using
Rails.cache
in conjunction with aThreadSafe::Cache
as theActiveSupport::Cache
seems to use one already under the hood. I'm using Rails v4.2.I'm planning on switching to
Concurrent::Map
once I upgrade my project from concurrent-ruby 0.9.2 to 1.0.0 and I can monkey patch until then.The text was updated successfully, but these errors were encountered: