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
The example in the guide is for Rails 5, how can I achieve this in Rails 4.2? I couldn't find interlock.rb file inside active_support/dependencies directory.
Expected behavior
futures=@current_user.posts.mapdo |p|
Concurrent::Promises.future(p)do |post|
ActiveRecord::Base.connection_pool.with_connectiondopost.cleanup_comments# Calls an API which takes ~2minutespost.destroyendendendresponses=futures.map(&:value)
This code should be able to destroy all posts of current-user concurrently.
Actual behavior
When I execute this code I get: Circular dependency detected while autoloading constant error
Note: I was able to solve this problem by putting these two lines in my config/application.rb file, but I'm not sure if thats the correct way to solve this circular dependency deadlock issue.
You can’t because it was added for Rails 5.0 iirc. Rails 4.2 is unsupported now, so the only to be able to enable that is to upgrade your Rails app. Thanks!
Steps to reproduce
When writing a multithreaded application it is advised to enable concurrent loads to avoid deadlock during autoloading.
link to guide
The example in the guide is for Rails 5, how can I achieve this in Rails 4.2? I couldn't find
interlock.rb
file insideactive_support/dependencies
directory.Expected behavior
This code should be able to destroy all posts of current-user concurrently.
Actual behavior
When I execute this code I get:
Circular dependency detected while autoloading constant
errorNote: I was able to solve this problem by putting these two lines in my
config/application.rb
file, but I'm not sure if thats the correct way to solve this circular dependency deadlock issue.System configuration
Rails version: rails -v # Rails 4.2.8
Ruby version: ruby -v # ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin18]
The text was updated successfully, but these errors were encountered: