Sha256: 15e43ae2cf375e19bf988614147f93f3ae1cd157f097c23a5614cec1622e2749
Contents?: true
Size: 761 Bytes
Versions: 3
Compression:
Stored size: 761 Bytes
Contents
module Instrumentation # Webserver using `puma` that handles requests for stats class Webserver def initialize @worker = nil end def run(app, opts = {}) config = build_config(opts.merge(app: app)) @launcher = Puma::Launcher.new(config, events: Puma::Events.stdio) @worker = Thread.new { @launcher.run } end def join @worker.join end def stop @launcher.stop @worker.kill end private def build_config(opts) Puma::Configuration.new do |c| host = opts.fetch(:host, Puma::Configuration::DefaultTCPHost) port = opts.fetch(:port, Puma::Configuration::DefaultTCPPort) c.port port, host c.app opts.fetch(:app) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems