Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1VNn-0004uS-PD for psycopg@arkaria.postgresql.org; Mon, 18 Jan 2021 14:19:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1VNm-0007sq-Ol for psycopg@arkaria.postgresql.org; Mon, 18 Jan 2021 14:19:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1VNm-0007sj-Ji for psycopg@lists.postgresql.org; Mon, 18 Jan 2021 14:19:50 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1VNj-0002cK-Na for psycopg@postgresql.org; Mon, 18 Jan 2021 14:19:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1610979585; bh=w4Foa+/XdJsTn/Ab1o+qKsFrXlljbaAvwMl5fbXKEd8=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=J5CSRVzoUe76KBFCcRaSKwUdX/qdL5yBF4YND8Et0Pa88VaOY03x1bT7YWBeKMWX6 ncTTHerHnHYcCeW8P9Xz2OynD481flygzd8f/zpnJF4bTrEfsDRxQlAgwPYmiRq7jz ySfXJQ+dpK1TTxkGPp8ugSIbRb7WePUz3SEJJTFY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermes ([89.12.167.206]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N0XCw-1lvWLt0tnQ-00wRIW; Mon, 18 Jan 2021 15:19:45 +0100 Received: from ncq by hermes with local (Exim 4.94) (envelope-from ) id 1l1VNg-0001dt-87; Mon, 18 Jan 2021 15:19:44 +0100 Date: Mon, 18 Jan 2021 15:19:44 +0100 From: Karsten Hilbert To: Daniele Varrazzo Cc: psycopg@postgresql.org Subject: Re: Designing a better connection pool for psycopg3 Message-ID: Mail-Followup-To: Daniele Varrazzo , psycopg@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) Sender: X-Provags-ID: V03:K1:FzPPLwz1sS5uAf9wYgLd47m63v+NqwWuJEOpSL8K96Xw1A3v89t +CV8AMHrZQ7iVjbYty59h3rDXNx2uJ6xRhUm5GFrIjMkLOBaeu6aTHOrNUNryu0/QC5/JxO WmxyW3eXCIP1qU9pFCgCsnOqaCdDDOWCw/3wFo02yKSr/2pKUxSWnUq2fS0++hNf63agGlU QRn14tnX899GZvk+2Tbgw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:YLjdYdsHhxo=:nGJDS9xcCjWYL1W/4gPUF2 FJKlCEx2+naFdr+/jO/O4DwwC5l1Kh8hnazXgYw+62mZEbhIFFyISlJaF+fm/Trya1lHKVguj W4ZGfBhA/qxgo5c0YZWQqkESDFOr4gGQmgig0n/H+lpUfJnu9UqQ7Sj8Z5kM94ffpDkeLJOWN gJsTIiDeo0+oYP9yI7357Xl3h1cHq/8e0wfFwg2+p15PdEEFcmlQQH2dJ9WeYCmjpo406xiaQ cDU5rh0RqMDDehbOjgidaoV67huL03S9oydlc4jQQ3rjph7CmrNvZwkmfocGWGUB1zfSePU3g 7y8i4tT/QcTDMRNeZ6jFOV3W9ElagybGT6I7hVpMIuKdGgaOpr95G9kSPUaJg1KNtw8RBVNhV ZpGwLiZdUT+2/MiJFkoKTz92iyd85FLkrSaEX/46qu4ik4riTh/ZIm4XeUpDih3S3zDvoL5aV dRnB12+r3L6cSqrpj4tP3wszTEX9f1C/5lgRpyV0yB0xh/U9z+SstGhbFuam0H9ZCEEksroUP Xx3r5zBYpL44BDhIWl85xdQafpo147xzligDcATsNTwkqq7Hm1n3g3F8K+NTOsTm0iFgkdO7q k8uirBzOmiU8M1tsS+eBSpveedDImjwtytxZG9tir1eg1367QNystL69KyjjSvovbexfTMQQC dFkBLoR16DEnsQM88JU8357LMebfC5hPH4Ek1KItsmkzPSUZ/3gdSntIUJEwsTk5sl/1S8ucq /dux0zMXdjlPBmITsvoqVnbkNn1kwWpgUAnYQ6Exc2xg5/aUGKPopU7/U7CnEEXGtJ5v//iOA 8dRDa5YDt9evSe3glyt2uJNcIKVAiAF66tEfYZSld839JMTCUSyn3xl1Ne329XZGqXbA+O/YM pOtHqxbf/EJDDBZGRe4f/NqW7ieKa3Br7e6GDv0/4= Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Am Mon, Jan 18, 2021 at 02:50:34PM +0100 schrieb Daniele Varrazzo: > > I would strongly advise against making sys.exit() the default > > for pool.terminate() unless I misunderstand something. > > How would you terminate the program if a maintenance thread, not the > main one, thinks that the program is not in working state? To me it is not the business of a library to terminate its user (eg an application) upon resource starvation. After all, the app may be perfectly fine with not being able to talk to the database. Only it knows what to do under such circumstances. If one wants to support such machinery, I would suggest a callback into the application, set up by the application code. Karsten =2D- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B