Hi, in my app I'm trying to test if a DB connection works during startup.
However I've realized that, in case the DB host doesn't reply, the emthod
"test_connection" gets blocked forever, and the worst: it blocks the entire
Ruby process so threading is not possible:
irb(main):003:0> require "sequel"
true
irb(main):003:0> require "timeout"
true
irb(main):004:0> Timeout::timeout(2) {
Sequel.connect("mysql://lala:[email protected]/lala").test_connection
}
#### after lot of time waiting I interrupt by pressing Ctrl+C and get this:
^C
Sequel::DatabaseConnectionError: IRB::Abort: abort then interrupt!!
from /usr/local/lib/ruby1.9/1.9.1/irb.rb:88:in `irb_abort'
from /usr/local/lib/ruby1.9/1.9.1/irb.rb:255:in `signal_handle'
from /usr/local/lib/ruby1.9/1.9.1/irb.rb:65:in `block in start'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:110:in
`call'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:110:in
`new'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:110:in
`real_connect'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/mysql.rb:110:in
`connect'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/database.rb:93:in
`block in initialize'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_pool.rb:169:in
`call'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_pool.rb:169:in
`make_new'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_pool.rb:156:in
`available'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_pool.rb:147:in
`block
in acquire'
from <internal:prelude>:8:in `synchronize'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_pool.rb:146:in
`acquire'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_pool.rb:102:in
`hold'
from
/usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/database.rb:482:in
`synchronize'
--
Iñaki Baz Castillo <[email protected]>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.