From: Daniele Varrazzo Date: Sat, 26 Mar 2022 01:32:31 +0000 (+0100) Subject: docs: add back lost comment and extend it with new knowledge X-Git-Tag: 3.1~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=17df0447961caed07974455835228364ba45c247;p=thirdparty%2Fpsycopg.git docs: add back lost comment and extend it with new knowledge --- diff --git a/psycopg/psycopg/generators.py b/psycopg/psycopg/generators.py index dbee2b2d1..5f8f967fb 100644 --- a/psycopg/psycopg/generators.py +++ b/psycopg/psycopg/generators.py @@ -203,6 +203,12 @@ def copy_from(pgconn: PGconn) -> PQGen[Union[memoryview, PGresult]]: def copy_to(pgconn: PGconn, buffer: bytes) -> PQGen[None]: + # Retry enqueuing data until successful. + # + # WARNING! This can cause an infinite loop if the buffer is too large. (see + # ticket #255). We avoid it in the Copy object by splitting a large buffer + # into smaller ones. We prefer to do it there instead of here in order to + # do it upstream the queue decoupling the writer task from the producer one. while pgconn.put_copy_data(buffer) == 0: yield Wait.W