Psycopg2 unable to timeout

Поиск
Список
Период
Сортировка
От Will Platnick
Тема Psycopg2 unable to timeout
Дата
Msg-id CAJDzJM5kkqr=HHqz7_xijEOXLdR=wM4HDigbyr=+6M55Pjf_aw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Psycopg2 unable to timeout  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
Good morning!

I am making a program to assist with failing over our PostgreSQL
master/slave architecture. I am currently using Psycopg2 to talk to
the Postgres databases, but I've run into an issue in our environment.

We use pgbouncer in our environment, and when pgbouncer is up, but
postgres is down, psycopg2 just hangs. I need to implement a timeout
at the Python level since I can't rely on a statement timeout for this
use, so that if a cursor or execute has been running for x seconds and
doesn't end, I can force an exception.

In most Python code, I can use signals to check this out, as described
in http://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish

But with psycopg2, it goes into a state where my timeouts can't work.

Is there anyway to implement a timeout at the psycopg2 side?


В списке psycopg по дате отправления:

Предыдущее
От: Jan Urbański
Дата:
Сообщение: missing NOTIFY events in async mode
Следующее
От: Abraham Elmahrek
Дата:
Сообщение: Psycopg license