module Messaging module Middleware # Used for hot code reloading (in development) and connection handling. # This makes Rails automatically return AR connections to the pool after we # have used them when processing a messages. # # See https://guides.rubyonrails.org/threading_and_code_execution.html for more information. class RailsWrapper attr_accessor :app def initialize(app) self.app = app end def call(*_args) app.reloader.wrap do yield end end end end end