diff options
author | Eric Wong <e@80x24.org> | 2013-10-22 22:46:25 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2013-10-22 23:08:46 +0000 |
commit | 28163a34ceff8334b2af4c5c30ec1e642efb9be1 (patch) | |
tree | 6219d20af729502cd20b942fb8700bffea741f16 /examples | |
parent | b79ba40ff559f9676c7bad530eeab6b7eb6a91f1 (diff) | |
download | yahns-28163a34ceff8334b2af4c5c30ec1e642efb9be1.tar.gz |
These can be used to disconnect/reconnect to databases and other external connections. These are named to match the documentation of pthread_atfork(3)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/yahns_rack_basic.conf.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/examples/yahns_rack_basic.conf.rb b/examples/yahns_rack_basic.conf.rb index ea367cd..3364587 100644 --- a/examples/yahns_rack_basic.conf.rb +++ b/examples/yahns_rack_basic.conf.rb @@ -3,7 +3,21 @@ # A typical Rack example for hosting a single Rack application with yahns # and only frequently-useful config values -worker_processes 1 +worker_processes(1) do + # these names are based on pthread_atfork(3) documentation + atfork_child do + defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection + puts "#$$ yahns worker is running" + end + atfork_prepare do + defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect! + puts "#$$ yahns parent about to spawn" + end + atfork_parent do + puts "#$$ this is probably not useful" + end +end + # working_directory "/path/to/my_app" stdout_path "/path/to/my_logs/out.log" stderr_path "/path/to/my_logs/err.log" |