erleans / pgo

Erlang Postgres client and connection pool
Apache License 2.0
80 stars 16 forks source link

Set pgo:query/3 timeout #50

Closed benbro closed 3 years ago

benbro commented 3 years ago

Is there a way to set a timeout for pgo:query/3? I couldn't find a way to increase it. I have SQL query that deleted many records and takes a long time.

tsloughter commented 3 years ago

Yea, but looks like it is confusing to do and I should improve it (plus add a test for it!). Pretty sure it is a timeout under the pool_options, so something like:

pgo:query(Query, Params, #{pool_options => [{timeout, 60000}]})
benbro commented 3 years ago

Isn't this timeout for getting a worker from the pool and not for executing the query? Also, does it make sense to have an option to send a query without waiting for a response?

tsloughter commented 3 years ago

Na, pretty sure the timeout there is for how long you can hold on to the connection.

benbro commented 3 years ago

I'll try it. thanks.