socketry / async-postgres

78 stars 11 forks source link

It doesn't work with Sequel #4

Open janko opened 6 years ago

janko commented 6 years ago

I'm aware that async-postgres is still experimental, but I just thought I would report that it currently doesn't successfully hook into the Sequel Postgres adapter. The following script executes in 10 seconds:

ENV["NO_SEQUEL_PG"] = "1" # don't activate the sequel_pg gem if it's installed

require "async"
require "async/postgres"
require "sequel"

DB = Sequel.postgres("postgres")

Async.run do |task|
  task.async do
    DB.get{pg_sleep(5)}
  end

  task.async do
    DB.get{pg_sleep(5)}
  end
end

I was looking at Sequel::Postgres, but it's fairly complex due to supporting different versions of the pg gem, along with postgres-pr and the additional sequel_pg gem, so I couldn't really find what has to be overridden.