Flowdock
method

retrieve_pool_options

Importance_0
v7.1.3.2 - Show latest stable - 0 notes - Class: ActiveSupport::Cache::Store
retrieve_pool_options(options) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/cache.rb, line 206
          def retrieve_pool_options(options)
            if options.key?(:pool)
              pool_options = options.delete(:pool)
            elsif options.key?(:pool_size) || options.key?(:pool_timeout)
              pool_options = {}

              if options.key?(:pool_size)
                ActiveSupport.deprecator.warn(<<~MSG)
                  Using :pool_size is deprecated and will be removed in Rails 7.2.
                  Use `pool: { size: #{options[:pool_size].inspect} }` instead.
                MSG
                pool_options[:size] = options.delete(:pool_size)
              end

              if options.key?(:pool_timeout)
                ActiveSupport.deprecator.warn(<<~MSG)
                  Using :pool_timeout is deprecated and will be removed in Rails 7.2.
                  Use `pool: { timeout: #{options[:pool_timeout].inspect} }` instead.
                MSG
                pool_options[:timeout] = options.delete(:pool_timeout)
              end
            else
              pool_options = true
            end

            case pool_options
            when false, nil
              return false
            when true
              pool_options = DEFAULT_POOL_OPTIONS
            when Hash
              pool_options[:size] = Integer(pool_options[:size]) if pool_options.key?(:size)
              pool_options[:timeout] = Float(pool_options[:timeout]) if pool_options.key?(:timeout)
              pool_options = DEFAULT_POOL_OPTIONS.merge(pool_options)
            else
              raise TypeError, "Invalid :pool argument, expected Hash, got: #{pool_options.inspect}"
            end

            pool_options unless pool_options.empty?
          end
Register or log in to add new notes.