MagicStack / MagicStack/asyncpg
Allow coroutines on add_listener.
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
The current code that process a notification uses the method `call_soon` which expects a callable, why not to use `create_task` (or `ensure_future` for compatibility reasons) after checking if the callback is a coroutine?
There are different ways to do this, either just checking if the callback is a coroutine as described in [here](https://stackoverflow.com/questions/36076619/test-if-function-or-method-is-normal-or-asynchronous) for example. Another way is just to add an extra argument or a different method to register coroutines.
Would it make sense to add a context? I am currently passing extra arguments to the callback via `functools.partial`.
Let me know if something like this would be accepted I can create a PR with the implementation.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Start at the add_listener entry point and the notification processing that currently calls call_soon. Compare create_task and ensure_future for coroutine callbacks, including the existing functools.partial usage for extra arguments. Done should include an agreed callback API and compatibility behavior, with tests covering regular and coroutine listeners.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- api, database
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 32/100