Sha256: b9e3060e1eec9550cd64c8aaabfc841774b9365019f4033967324171d7a474ad

Contents?: true

Size: 509 Bytes

Versions: 14

Compression:

Stored size: 509 Bytes

Contents

module PhobosDBCheckpoint
  module Middleware
    class Database

      def initialize(app, options = {})
        @app = app
        pool_size = options.fetch(:pool_size, PhobosDBCheckpoint::DEFAULT_POOL_SIZE)
        PhobosDBCheckpoint.configure(pool_size: pool_size)
      end

      def call(request_env)
        ActiveRecord::Base.connection_pool.with_connection do
          @app.call(request_env)
        end
      ensure
        ActiveRecord::Base.clear_active_connections!
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
phobos_db_checkpoint-3.1.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-3.0.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.4.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.3.1 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.3.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.2.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.1.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.0.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-2.0.0.rc1 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-1.1.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-1.0.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-0.5.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-0.4.0 lib/phobos_db_checkpoint/middleware/database.rb
phobos_db_checkpoint-0.3.0 lib/phobos_db_checkpoint/middleware/database.rb