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 1jeLhB-0007Xr-P0 for psycopg@arkaria.postgresql.org; Thu, 28 May 2020 16:47:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jeLhA-00085r-NQ for psycopg@arkaria.postgresql.org; Thu, 28 May 2020 16:47:52 +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 1jeLhA-00082m-HY for psycopg@lists.postgresql.org; Thu, 28 May 2020 16:47:52 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jeLh4-0006Qx-7X for psycopg@postgresql.org; Thu, 28 May 2020 16:47:51 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 888B15C00BD; Thu, 28 May 2020 12:47:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 28 May 2020 12:47:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=B lTYG1RTV/EnFrVHUlQxBgYl8N0Z+prKwHkQ7cx/UVk=; b=tvRJTQdTemWL8k8AV 1sIm1KW1WAZx1Iw2HBZ8ODjj59wa4weW/mCzwURXWgMjLi92RqJd+fo5C2EZ2hvO /MwknjC1P4/SqAa0HV5ixJTKE2r6Yk4pcE49Kcv9lRLW+Ex8yUw91JcsbuO7VhVy CeCcnN4gFJoo3ZI/ZpJ7s5MGBuYmRaYSkhzkfvyO6cMY48VaSJjde80c9QY2qFTr yda3ModyRhejq/WYSkSKyZTsqwPOjNmiEni2Ww8bwMVM+bUCfkbOyzcvuYGJIvOH T5oVnkEOMxGF44/a21HYjq6UyFhDcK5tWNp9Nc7uEGd+S35oEIG84qRj+JFdP0zv 50jeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=BlTYG1RTV/EnFrVHUlQxBgYl8N0Z+prKwHkQ7cx/U Vk=; b=ZerhjHsYQsNResr1yPsV/CGoUqg4Kq8Hbjrxue2tNkCv6rP4RB054WmTq xeyPYEXI1S3WU3vc6ZIOyrlU9zbilwLX6O7KRBJotjoMiqBiGM2pJD52jeT3FwKk eJjf6y/R8ppiiBjTYwXJh4tiRGpnnGouqA3GRFjM8A4IeLWcO83hsvMIn33OIHvj WPeXvMRebXAvltjBEWtK5sqC+rf7fDWnAXEUJ/ImN5CdjV5Ffb9pZLbyG8YQHEgH jt3bBOMcucwiZQ4nhIrFNe0EGdlSYiRK4gmlX8wnFSTt+lLpbBVxHBJfPZ5GdFFw +HQQ9m1zKMvvQqlZX5mlenRcvwq6g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddviedgheegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpefgffeiffffgfehtdeufeelfeeuudffteelfeegleel teehgedvveefvdelleeukeenucffohhmrghinhepghhithhhuhgsrdgtohhmnecukfhppe ejhedrudejvddrhedrvdefudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id DB3773061CB6; Thu, 28 May 2020 12:47:44 -0400 (EDT) Subject: Re: Async notifications in psycopg3 To: Daniele Varrazzo , psycopg@postgresql.org References: From: Adrian Klaver Message-ID: Date: Thu, 28 May 2020 09:47:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/26/20 6:22 AM, Daniele Varrazzo wrote: > Hello, > > I have introduced async notifications handling for psycopg3. At the > moment it comes in the form of a generator (eventually async - in > asyncio sense) so that they can be used as simply as: > > for notify in conn.notifies(): > # ... process > > but notifies may be also received during the normal query processing, > for which a possible way to receive them can is a callback. > > I am not entirely convinced about the design so I'd be happy to > receive some feedback by anyone who has ideas about how they would use > the features. There is a more complete description and references in > : happy to have a > conversation either here or on the github ticket. When I get a chance I will take a look. > > Cheers, > > -- Daniele > > -- Adrian Klaver adrian.klaver@aklaver.com