From: Daniele Varrazzo Date: Sat, 27 Jan 2024 02:51:20 +0000 (+0000) Subject: docs: add docs about timeout and stop_after notification parameters X-Git-Tag: 3.2.0~87^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3ea3630b43a6c836f02549a6f1663291d2cd3fa;p=thirdparty%2Fpsycopg.git docs: add docs about timeout and stop_after notification parameters --- diff --git a/docs/advanced/async.rst b/docs/advanced/async.rst index bf7526071..ef1f6c151 100644 --- a/docs/advanced/async.rst +++ b/docs/advanced/async.rst @@ -334,7 +334,8 @@ mode if you wish to receive or send notifications in a timely manner. Notifications are received as instances of `Notify`. If you are reserving a connection only to receive notifications, the simplest way is to consume the `Connection.notifies` generator. The generator can be stopped using -`!close()`. +`!close()`. Starting from Psycopg 3.2, the method supports options to receive +notifications only for a certain time or up to a certain number. .. note:: diff --git a/docs/api/connections.rst b/docs/api/connections.rst index a607f07fa..898a8470d 100644 --- a/docs/api/connections.rst +++ b/docs/api/connections.rst @@ -286,6 +286,10 @@ The `!Connection` class any sessions in the database generates a :sql:`NOTIFY` on one of the listened channels. + .. versionchanged:: 3.2 + + Added `!timeout` and `!stop_after` parameters. + .. automethod:: add_notify_handler See :ref:`async-notify` for details. @@ -494,6 +498,11 @@ The `!AsyncConnection` class ... .. automethod:: notifies + + .. versionchanged:: 3.2 + + Added `!timeout` and `!stop_after` parameters. + .. automethod:: set_autocommit .. automethod:: set_isolation_level .. automethod:: set_read_only diff --git a/docs/news.rst b/docs/news.rst index 5c201a44d..cecffd40c 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -15,6 +15,8 @@ Psycopg 3.2 (unreleased) - Add support for integer, floating point, boolean `NumPy scalar types`__ (:ticket:`#332`). +- Add `!timeout` and `!stop_after` parameters to `Connection.notifies()` + (:ticket:`340`). - Add :ref:`raw-query-cursors` to execute queries using placeholders in PostgreSQL format (`$1`, `$2`...) (:ticket:`#560`). - Add `~Connection.set_autocommit()` on sync connections, and similar