mperham / connection_pool

Generic connection pooling for Ruby
MIT License
1.63k stars 143 forks source link

Return value from ConnectionPool#with #59

Closed natesymer closed 10 years ago

natesymer commented 10 years ago

It's often hard ugly to use ConnectionPool's concurrency in a performant way (read: without the wrapper). I modified the ConnectionPool#with method so that it returns whatever its block returns.

def exec(sql)
  res = nil
  @pool.with { |pg| res = pg.exec sql }
  res
end

Look more like this

def exec(sql)
  @pool.with { |pg| pg.exec sql }
end
mperham commented 10 years ago

What the duece? It doesn't work like this already???