Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

add optional support for unicorn-worker-killer in config.ru #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions templates/config.ru/99-run-3.0.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ ARGV << "--color" << "false"
ARGV << "--confdir" << "<%= @puppet_confdir %>"
ARGV << "--vardir" << "<%= @puppet_vardir %>"

begin
require 'unicorn/worker_killer'

max_request_min = 500
max_request_max = 600

use Unicorn::WorkerKiller::MaxRequests, max_request_min, max_request_max

oom_min = (240) * (1024**2)
oom_max = (260) * (1024**2)

use Unicorn::WorkerKiller::Oom, oom_min, oom_max
rescue LoadError
end

# NOTE: it's unfortunate that we have to use the "CommandLine" class
# here to launch the app, but it contains some initialization logic
# (such as triggering the parsing of the config file) that is very
Expand Down