mirror of
				https://github.com/psycopg/psycopg2.git
				synced 2025-11-04 01:37:31 +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
							
								
									283dbccf56
								
							
						
					
					
						commit
						ca99579b76
					
				| 
						 | 
					@ -506,10 +506,6 @@ conn_setup(connectionObject *self, PGconn *pgconn)
 | 
				
			||||||
    pthread_mutex_lock(&self->lock);
 | 
					    pthread_mutex_lock(&self->lock);
 | 
				
			||||||
    Py_BLOCK_THREADS;
 | 
					    Py_BLOCK_THREADS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (psyco_green() && (0 > pq_set_non_blocking(self, 1))) {
 | 
					 | 
				
			||||||
        return -1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!conn_is_datestyle_ok(self->pgconn)) {
 | 
					    if (!conn_is_datestyle_ok(self->pgconn)) {
 | 
				
			||||||
        int res;
 | 
					        int res;
 | 
				
			||||||
        Py_UNBLOCK_THREADS;
 | 
					        Py_UNBLOCK_THREADS;
 | 
				
			||||||
| 
						 | 
					@ -573,6 +569,9 @@ _conn_sync_connect(connectionObject *self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* if the connection is green, wait to finish connection */
 | 
					    /* if the connection is green, wait to finish connection */
 | 
				
			||||||
    if (green) {
 | 
					    if (green) {
 | 
				
			||||||
 | 
					        if (0 > pq_set_non_blocking(self, 1)) {
 | 
				
			||||||
 | 
					            return -1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (0 != psyco_wait(self)) {
 | 
					        if (0 != psyco_wait(self)) {
 | 
				
			||||||
            return -1;
 | 
					            return -1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user