瀏覽代碼

Improve ActiveRecord connection in on_worker_boot (#9238)

This is how it looks in the example in the Puma README
master
Eugen Rochko 5 年之前
committed by GitHub
父節點
當前提交
ed7c5f94f7
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. +3
    -1
      config/puma.rb

+ 3
- 1
config/puma.rb 查看文件

@@ -13,7 +13,9 @@ workers ENV.fetch('WEB_CONCURRENCY') { 2 }
preload_app!

on_worker_boot do
ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end

plugin :tmp_restart

Loading…
取消
儲存