puma.rb 758 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. worker_count = Integer(ENV['WEB_CONCURRENCY'] || 0)
  3. workers worker_count
  4. threads_count_min = Integer(ENV['MIN_THREADS'] || 5)
  5. threads_count_max = Integer(ENV['MAX_THREADS'] || 30)
  6. threads threads_count_min, threads_count_max
  7. environment ENV.fetch('RAILS_ENV', 'development')
  8. preload_app!
  9. begin
  10. on_booted do
  11. AppVersion.start_maintenance_thread(process_name: 'puma')
  12. end
  13. rescue NoMethodError
  14. # Workaround for https://github.com/puma/puma/issues/3356, can be removed after this is
  15. # solved and a new puma version is released where 'pumactl status' works again.
  16. end
  17. if worker_count.positive?
  18. on_worker_boot do
  19. ActiveRecord::Base.establish_connection
  20. end
  21. end