Re: psycopg2 (async) socket timeout - Mailing list psycopg

From Mark Theisen
Subject Re: psycopg2 (async) socket timeout
Date
Msg-id 26856422.494.1297279096146.JavaMail.root@zimbra
Whole thread Raw
In response to psycopg2 (async) socket timeout  (Danny Milosavljevic <danny.milo@gmail.com>)
List psycopg
You could add connect_timeout to the dsn, e.g. dsn = "host='localhost' dbname='test' connect_timeout=60".
http://www.postgresql.org/docs/8.4/static/libpq-connect.html#AEN33199.I don't know if this will help with your
situation,but it might. 

Mark

----- Original Message -----
From: "Danny Milosavljevic" <danny.milo@gmail.com>
To: psycopg@postgresql.org
Sent: Thursday, February 3, 2011 2:04:39 PM
Subject: [psycopg] psycopg2 (async) socket timeout

Hello,

is it possible to specify the timeout for the socket underlying a connection?

Alternatively, since I'm using the async interface anyway, is it
possible proactively cancel a query that is "stuck" since the TCP
connection to the database is down?

So the specific case is:
- connect to the postgres database using psycopg2 while network is up
- run some queries, get the results fine etc
- send a query
- the network goes down before the result to this last query has been received
- neither a result nor an error callback gets called - as far as I can
see (using txpostgres.ConnectionPool)

What's the proper way to deal with that?

Regards,
   Danny

--
Sent via psycopg mailing list (psycopg@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/psycopg

psycopg by date:

Previous
From: Jan Urbański
Date:
Subject: Re: psycopg2 (async) socket timeout
Next
From: Daniele Varrazzo
Date:
Subject: Psycopg on OSX