mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 12:50:32 +03:00
Set the connection async earlier in green mode
The moment it is called shouldn't have really changed, but it's more explicit when it happens. Previously it was sort of obfuscated behind a roundtrip through the green callback and poll.
This commit is contained in:
parent
731dc2a3ef
commit
3a8dec76a0
|
@ -506,10 +506,6 @@ conn_setup(connectionObject *self, PGconn *pgconn)
|
|||
pthread_mutex_lock(&self->lock);
|
||||
Py_BLOCK_THREADS;
|
||||
|
||||
if (psyco_green() && (0 > pq_set_non_blocking(self, 1))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!conn_is_datestyle_ok(self->pgconn)) {
|
||||
int res;
|
||||
Py_UNBLOCK_THREADS;
|
||||
|
@ -573,6 +569,9 @@ _conn_sync_connect(connectionObject *self)
|
|||
|
||||
/* if the connection is green, wait to finish connection */
|
||||
if (green) {
|
||||
if (0 > pq_set_non_blocking(self, 1)) {
|
||||
return -1;
|
||||
}
|
||||
if (0 != psyco_wait(self)) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user