-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Replace ActiveSupport::Concurrency::Latch
with Concurrent::CountDownLatch
from concurrent-ruby.
#20866
Conversation
@jdantonio thanks. I don't think this is enough though. We have runtime requirements for the countdown latch. Can you update the gemspecs that need concurrent-ruby to depend on it? I think only actionpack needs it. Also we may want to consider adding a deprecation warning for the countdown latch that's in Rails (though since this is Rails 5, and I don't think many people use our latch I'm not sure we need that). |
Sorry I missed the runtime requirement. I thought it was only used in tests. I'll update ASAP. |
@jdantonio thanks so much! Also, if you don't mind, could you check our uses of the |
@tenderlove We have not merged thread_safe into concurrent-ruby yet, just ruby-atomic. We want to get c-r 1.0 out before we merge thread_safe. |
I see. Nevermind about |
The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`, which is functionally equivalent.
@tenderlove I put I removed c-r from Gemfile and put the c-r dependency in the gemspec for activesupport (since it now uses CountDownLatch directly). Both actionpack and activerecord use CountDownLatch in their tests but both should pick up the dependency through activesupport. I couldn't find any place in actionpack that used the original Latch and the tests all passed on the original commit. I added c-r to its gemspec anyway, at your suggestion. |
Replace `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch` from concurrent-ruby.
This update was suggested by @tenderlove in a discussion on one of his PRs to concurrent-ruby.
The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces
ActiveSupport::Concurrency::Latch
withConcurrent::CountDownLatch
, which is functionally equivalent.