Skip to content

Fix the default number of puma threads#3

Merged
zacblazic merged 6 commits intomasterfrom
fix-default-puma-threads
Feb 23, 2018
Merged

Fix the default number of puma threads#3
zacblazic merged 6 commits intomasterfrom
fix-default-puma-threads

Conversation

@zacblazic
Copy link
Copy Markdown
Member

See commits for details.

Previously if you did not specify the `GEMSTASH_PUMA_THREADS`
environment variable, the value of `:puma_threads` would default
to 0.

This was because `ENV['GEMSTASH_PUMA_THREADS']` results in an empty
string, which returns 0 when `#to_i` is called on it.

I've chosen 16 as the default as it is what has been used as the
default by gemstash.
The same logic for choosing the correct number of `:max_connections`
has been implemented in gemstash itself.

This saves us from having to repeat ourselves with specifying
`(ENV['GEMSTASH_PUMA_THREADS'] || 16).to_i + 1` on each adapter.
Comment thread app/config.yml.erb
:cache_type: memory
:rubygems_url: https://rubygems.org
:puma_threads: <%= ENV['GEMSTASH_PUMA_THREADS'].to_i %>
:puma_threads: <%= (ENV['GEMSTASH_PUMA_THREADS'] || 16).to_i %>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha!

Copy link
Copy Markdown

@tsu-shiuan tsu-shiuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks sensible

@zacblazic zacblazic merged commit ea7b5ba into master Feb 23, 2018
@zacblazic zacblazic deleted the fix-default-puma-threads branch February 23, 2018 12:59
@zacblazic zacblazic mentioned this pull request Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants