Hi all,
How can I force a connection to be disconnected? I'm running a Padrino
application (very similar to Sinatra) and use code similar to the following:
attr_reader :db
before do
options = {
test: true,
max_connections: 1,
sslmode: "prefer",
logger: Padrino.logger,
user: user.username,
password: user.password}
Padrino.logger.debug "Connecting to #{user.dburl} as
#{user.username.inspect}"
Sequel.connect(user.dburl, options)
end
after do
db.disconnect if db
end
# in a controller
get "/" do
db[:parties].count.to_s
end
What I notice is that after each HTTP request, pg_stat_activity reports one
more open connection. The documentation for #disconnect specifically say
"Any connections currently in use will not be disconnected."
I've tried switching to the single threaded pool, but I still get a new
connection per HTTP request. If I pass test: false, I still get a new
connection because the controller issues database requests.
I would like for the connection pool to completely disconnect all database
connections. Is there a way to enforce that?
Thanks!
François Beausoleil
$ ruby --version
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin10.0]
$ bundle show | grep -E 'sequel|pg'
* pg (0.16.0)
* sequel (4.8.0)
* sequel_pg (1.6.8)
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.