mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
14 lines
336 B
Ruby
14 lines
336 B
Ruby
|
# pg performs inconsistently with large amounts of connections
|
||
|
# this helps keep connection counts in check
|
||
|
Thread.new do
|
||
|
while true
|
||
|
sleep 30
|
||
|
pools = []
|
||
|
ObjectSpace.each_object(ActiveRecord::ConnectionAdapters::ConnectionPool){|pool| pools << pool}
|
||
|
|
||
|
pools.each do |pool|
|
||
|
pool.drain(30.seconds)
|
||
|
end
|
||
|
end
|
||
|
end
|