MySql database connections not being released

11 views
Skip to first unread message

Richard Nienaber

unread,
Aug 30, 2014, 12:08:29 PM8/30/14
to golia...@googlegroups.com
Hi

I'm having some trouble getting multiple database queries running in a single http request. I've documented the error messages on stackoverlflow here: http://stackoverflow.com/questions/25582028/mysql-database-connections-not-being-released-on-goliath. The method looks like this:

    multi = EventMachine::Synchrony::Multi.new

    (1..2).each do |id|
      multi.add id, DB.aquery("select #{id}")
    end

    results = []
    perform_response = multi.perform
    perform_response.responses[:callback].each do |res|
      res.last.callback{|r| results << r.first}
    end
    [200, {'Content-Type' => 'application/json; charset=utf-8'}, results]
And the error message is this:

This connection is still waiting for a result, try again once you have the result (Mysql2::Error)
I know I must be doing something wrong but I'm not sure what it is. I'm hoping someone can point in me in the right direction.

Thanks
Richard
Reply all
Reply to author
Forward
0 new messages