Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frameworks/roda/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def self.get_async_db
def self.redis
@redis ||= begin
return unless ENV['REDIS_URL']
max_connections = ENV.fetch('MAX_THREADS', 4).to_i
max_connections = ENV.fetch('MAX_THREADS', 4).to_i + ENV.fetch("MAX_IO_THREADS", 10).to_i
ConnectionPool::Wrapper.new(size: max_connections, timeout: 10) do
Redis.new(url: ENV['REDIS_URL'])
end
Expand Down
4 changes: 3 additions & 1 deletion frameworks/roda/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ require_relative 'app'

# Threads marked as IO bound are allowed to go over Puma's max thread limit.
class MarkAsIOBoundThreads
IOBoundPaths = %w[/baseline11 /baseline2 /async-db].map { [_1, nil] }.to_h.freeze

def initialize(app)
@app = app
end

def call(env)
if env['PATH_INFO'].start_with? '/baseline'
if IOBoundPaths.has_key? env['PATH_INFO']
env["puma.mark_as_io_bound"].call
end
@app.call(env)
Expand Down