From 170256384cf98fa15c5d74beff963653dc037d4f Mon Sep 17 00:00:00 2001 From: tschafer-gc Date: Fri, 8 Nov 2024 10:01:24 +0000 Subject: [PATCH] Switch from WEBrick to Puma --- bin/que | 39 ++++++++++++--------------------------- que.gemspec | 3 +-- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/bin/que b/bin/que index b38d3f9..8c94f0d 100755 --- a/bin/que +++ b/bin/que @@ -4,16 +4,12 @@ require "logger" require "optparse" require "ostruct" -require "que" -require "rack" require "prometheus/middleware/exporter" require "prometheus_gcstat" -require "webrick" - -if Rack.release[0] == "3" - # Required if using Rack 3.x - require "rackup" -end +require "puma" +require "que" +require "rack" +require "rack/handler/puma" $stdout.sync = true @@ -176,25 +172,14 @@ if options.metrics_port ) host = "0.0.0.0" - logger = WEBrick::Log.new("/dev/null") - - if Rack.release[0] == "3" - Rackup::Handler::WEBrick.run( - app, - Host: host, - Port: options.metrics_port, - Logger: logger, - AccessLog: [], - ) - else - Rack::Handler::WEBrick.run( - app, - Host: host, - Port: options.metrics_port, - Logger: logger, - AccessLog: [], - ) - end + + Rack::Handler::Puma.run( + app, + Host: host, + Port: options.metrics_port, + Silent: false, + AccessLog: [], + ) end end diff --git a/que.gemspec b/que.gemspec index 2c0b74c..e0e5197 100644 --- a/que.gemspec +++ b/que.gemspec @@ -27,9 +27,8 @@ Gem::Specification.new do |spec| # This is highly non ideal, but unless we properly fork, we have to do this for now. spec.add_dependency "prometheus-client" + spec.add_dependency "puma" spec.add_dependency "rack", ">= 2", "< 4" - spec.add_dependency "rackup" - spec.add_dependency "webrick" spec.add_runtime_dependency "activesupport" spec.metadata["rubygems_mfa_required"] = "true"