Sha256: 102b29e6e3bb105c8a08203eca6fcb257644e29fc78dc96b9fd5f7019cd55682

Contents?: true

Size: 558 Bytes

Versions: 12

Compression:

Stored size: 558 Bytes

Contents

module Sidekiq
  module Middleware
    module Server
      class ActiveRecord

        def initialize
          # With Rails 5+ we must use the Reloader **always**.
          # The reloader handles code loading and db connection management.
          if ::Rails::VERSION::MAJOR >= 5
            raise ArgumentError, "Rails 5 no longer needs or uses the ActiveRecord middleware."
          end
        end

        def call(*args)
          yield
        ensure
          ::ActiveRecord::Base.clear_active_connections!
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sidekiq-5.1.1 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.1.0 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.5 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.4 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.3 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.2 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.1 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.0 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.0.rc1 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.0.beta3 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.0.beta2 lib/sidekiq/middleware/server/active_record.rb
sidekiq-5.0.0.beta1 lib/sidekiq/middleware/server/active_record.rb