mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
Fix HUP fork restart of database, and speed up postgres hits
This commit is contained in:
parent
a004489e43
commit
a0299d0e46
4 changed files with 10 additions and 1 deletions
1
Gemfile
1
Gemfile
|
@ -11,6 +11,7 @@ gem 'puma', require: nil
|
||||||
|
|
||||||
platform :mri do
|
platform :mri do
|
||||||
gem 'pg'
|
gem 'pg'
|
||||||
|
gem 'sequel_pg', require: nil
|
||||||
gem 'hiredis'
|
gem 'hiredis'
|
||||||
gem 'rainbows', require: nil
|
gem 'rainbows', require: nil
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,9 @@ GEM
|
||||||
rake (10.0.4)
|
rake (10.0.4)
|
||||||
redis (3.0.4)
|
redis (3.0.4)
|
||||||
sequel (3.47.0)
|
sequel (3.47.0)
|
||||||
|
sequel_pg (1.6.6)
|
||||||
|
pg (>= 0.8.0)
|
||||||
|
sequel (>= 3.39.0)
|
||||||
shotgun (0.9)
|
shotgun (0.9)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
simplecov (0.7.1)
|
simplecov (0.7.1)
|
||||||
|
@ -110,6 +113,7 @@ DEPENDENCIES
|
||||||
redis
|
redis
|
||||||
ruby-debug
|
ruby-debug
|
||||||
sequel
|
sequel
|
||||||
|
sequel_pg
|
||||||
shotgun
|
shotgun
|
||||||
simplecov
|
simplecov
|
||||||
sinatra
|
sinatra
|
||||||
|
|
|
@ -12,7 +12,7 @@ Bundler.require :development if ENV['RACK_ENV'] == 'development'
|
||||||
|
|
||||||
$config = YAML.load_file(File.join(DIR_ROOT, 'config.yml'))[ENV['RACK_ENV']]
|
$config = YAML.load_file(File.join(DIR_ROOT, 'config.yml'))[ENV['RACK_ENV']]
|
||||||
|
|
||||||
DB = Sequel.connect $config['database']
|
DB = Sequel.connect $config['database'], sslmode: 'disable'
|
||||||
|
|
||||||
Dir.glob('workers/*.rb').each {|w| require File.join(DIR_ROOT, "/#{w}") }
|
Dir.glob('workers/*.rb').each {|w| require File.join(DIR_ROOT, "/#{w}") }
|
||||||
|
|
||||||
|
|
|
@ -27,4 +27,8 @@ Rainbows! do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after_fork do |server, worker|
|
||||||
|
DB.disconnect
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue