socketry / async-postgres

78 stars 11 forks source link

Doesn't seem to work with Rails 4 #6

Open ainar-g opened 5 years ago

ainar-g commented 5 years ago

Rails 4 seem to use the PG::Connection#connect method rather than PG#connect. If I add the following monkey-patch, the queries do seem to execute asynchronously:

module PG
  class Connection
    def self.connect(*args)
      Async::Postgres::Proxy.new(*args)
    end
  end
end

I can send a PR in a few weeks, if that's the way we want to go.

ioquatix commented 5 years ago

Please make a PR, this entire gem is a monkey patch experiment, adding a few more doesn't hurt.