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 1l1VZY-0005Ps-OP for psycopg@arkaria.postgresql.org; Mon, 18 Jan 2021 14:32:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1VZX-0002EA-Mh for psycopg@arkaria.postgresql.org; Mon, 18 Jan 2021 14:31:59 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1VZX-0002Do-Hf for psycopg@lists.postgresql.org; Mon, 18 Jan 2021 14:31:59 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l1VZV-0007zS-Hf for psycopg@postgresql.org; Mon, 18 Jan 2021 14:31:58 +0000 Received: by mail-lj1-x22e.google.com with SMTP id f17so18378215ljg.12 for ; Mon, 18 Jan 2021 06:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=tXPtTV4Vdu+xOh28gj6HE/zqKbS9xn+Ul3LsmoFb+RA=; b=BYeoBV4xIXvOOkn/ch0WOGm/hJLcDytAiXjNCe6xUtK1XVDGLcVwaSvpP3JNeLYFmg I0JbxoOXXunkodtS0/HCpfJZxRrqm0nACvPULiNmJ+ZUEsmkBwQexn9lYJvsOmgqG4ub wFjdr1COETTM+rEEa1MxHvUCdkqTKmUnlGlf3M/zq0eAzwyqqZFoh0RD6KVF4EP3bqcB YtKa0aQbcxqVp9Kk9j1+C3syT5k+L8MjwYltwrjEb7VZ+oinuGmuNP1Hbzry2HZQcbfd 5bCBol9K7fKJfmRb+GDVErDT5Z091nGlqRLrjzWdC91wEQiMdYV7cqF92JSXK7AW5Go+ MLLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=tXPtTV4Vdu+xOh28gj6HE/zqKbS9xn+Ul3LsmoFb+RA=; b=tbA4J7FoWn03p9j6nQBxQCMfd6C1ChBVSlGUzU6pa5Laj2axW/apwKrMA/yPNzyZrm XfLej4fnZNq3Dh+c/fK58zWHJfGUP/MaJ9Ojsxvw10gR+J7TAhtTzfKBOdowZKhXTdf9 JvIRvaU7eEjd4dMqaR31wBAdt40ZYADqT/hhqhTGkBS4i1UGzvU3wfbiJ5jn4ygvIsw+ ohaY9E6h5ToW8mUHNhpbURW+2oLbLuuqVdWubpg0b2YUZ8DGziZpgZPdTmJVzYxVRVyr JV8vka/TKL5nsXxBL1MTHZ2nluBg/4ssKEPs10OnJxYZ3Rfsr2EA9gsL7URKb1IZZnlG g6GQ== X-Gm-Message-State: AOAM533Ar5why9y0+xnC57hFzaykxJEmTddFcaOqoelh9VMSnxovmT4E FZGjUUtrHqli3XXFo6thiTkBp8T4BJwDfmVyg5SO6tUO X-Google-Smtp-Source: ABdhPJwPOShGXjts0FEVs8VZJ9sRa+rxb/7TrGN+++5nW8pH0m2CCN4r2MVa4ZO0l03gf8XLMJwXH5pwTV8pi95bnoA= X-Received: by 2002:a2e:6c0a:: with SMTP id h10mr10763870ljc.149.1610980315974; Mon, 18 Jan 2021 06:31:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Daniele Varrazzo Date: Mon, 18 Jan 2021 15:31:44 +0100 Message-ID: Subject: Re: Designing a better connection pool for psycopg3 To: Daniele Varrazzo , psycopg@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 18 Jan 2021 at 15:19, Karsten Hilbert wrote: > > 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. Thank you for the feedback, Karsten. Probably a customisable no-op callback is a better default behaviour :) -- Daniele