Class: Actions::Middleware::RailsExecutorWrap

Inherits:
Dynflow::Middleware
  • Object
show all
Defined in:
app/lib/actions/middleware/rails_executor_wrap.rb

Overview

In development with Rails auto-reloading and using ‘sync_task` method, it could lead to dead-locking due to the Rails main thread locking the the class loader.

This middleware marks the part of the code that can use the auto-loader so that Rails know they should avoid the locking there. See github.com/ruby-concurrency/concurrent-ruby/issues/585#issuecomment-256131537 for more details.

Instance Method Summary collapse

Instance Method Details

#finalizeObject



18
19
20
21
22
# File 'app/lib/actions/middleware/rails_executor_wrap.rb', line 18

def finalize
  ::Rails.application.executor.wrap do
    pass
  end
end

#run(*args) ⇒ Object



12
13
14
15
16
# File 'app/lib/actions/middleware/rails_executor_wrap.rb', line 12

def run(*args)
  ::Rails.application.executor.wrap do
    pass(*args)
  end
end