Skip to content

Commit

Permalink
Moved puma config around to prevent warning, re-enabled spring, unloc…
Browse files Browse the repository at this point in the history
…ked compass-rails version
  • Loading branch information
Dantemss committed Oct 17, 2024
1 parent 958b57c commit 29f532c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gem 'sass-rails'
gem 'bootstrap-sass'

# Compass stylesheets
gem 'compass-rails', '~> 4.0.0'
gem 'compass-rails'

# Prevent deprecation warning coming from Compass in Sass 3.4.20
gem 'sass', '3.4.19'
Expand Down Expand Up @@ -222,8 +222,8 @@ group :development, :test do
gem 'codecov', require: false

# Speedup and run specs when files change
#gem 'spring'
#gem 'spring-commands-rspec'
gem 'spring'
gem 'spring-commands-rspec'
gem 'guard-rspec'
gem 'guard-livereload', require: false

Expand Down
7 changes: 6 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,9 @@ GEM
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
spring (4.2.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.7.5)
base64
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -833,7 +836,7 @@ DEPENDENCIES
chronic
codecov
coffee-rails
compass-rails (~> 4.0.0)
compass-rails
database_cleaner
db-query-matchers
delayed_job_active_record
Expand Down Expand Up @@ -911,6 +914,8 @@ DEPENDENCIES
sentry-ruby
shoulda-matchers
smarter_csv
spring
spring-commands-rspec
timecop
uglifier
vcr
Expand Down
42 changes: 21 additions & 21 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,6 @@
true
) if ActiveModel::Type::Boolean.new.cast(ENV.fetch('REDIRECT_STDOUT', false))

before_fork do
require 'puma_worker_killer'

PumaWorkerKiller.config do |config|
# Restart workers when they start consuming too much of the RAM
config.ram = ENV.fetch('MAX_MEMORY') do
ENV.fetch('MAX_WORKER_MEMORY', 1024).to_i * NUM_WORKERS
end.to_i

config.frequency = 10

config.percent_usage = 0.75

config.rolling_restart_frequency = false

config.reaper_status_logs = false
end

PumaWorkerKiller.start
end

# https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/puma.rb.tt

# Puma can serve each request in a thread from an internal thread pool.
Expand Down Expand Up @@ -84,6 +63,27 @@
#
preload_app! if ActiveModel::Type::Boolean.new.cast(ENV.fetch('PRELOAD_APP', false))

before_fork do
require 'puma_worker_killer'

PumaWorkerKiller.config do |config|
# Restart workers when they start consuming too much of the RAM
config.ram = ENV.fetch('MAX_MEMORY') do
ENV.fetch('MAX_WORKER_MEMORY', 1024).to_i * NUM_WORKERS
end.to_i

config.frequency = 10

config.percent_usage = 0.75

config.rolling_restart_frequency = false

config.reaper_status_logs = false
end

PumaWorkerKiller.start
end

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

Expand Down

0 comments on commit 29f532c

Please sign in to comment.