Behavior of then() for a resolved promise?

オープン
#7 コメント 3 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
backend

調査の方向性

promise(val) の解決パスと then() から始め、Celery's EagerResult がすでに発火した on_ready promise をどのように使用するかを追跡します。解決後にコールバックを追加した場合の動作を定義して検証します。これには、issue で言及されているコールバックチェーンと解決の繰り返しが含まれます。

索引モデルが issue の本文から書いたものです。

説明

What's the expected behavior for calling then() on a resolved promise? Right now you add callbacks that will never get called.

E.g. using an EagerResult in celery you end up with something like this:

val = 40
result = EagerResult(val)
# Internally result.on_ready is a promise that has already fired, e.g. promise(val) is called.
result.then(callback, errback)
# Neither of these will ever fire.

I'd expect adding a callback to an already resolved promise to call it immediately.

Note that Twisted will immediately run your callbacks if a Deferred already has resolved, so I'm expecting the same behavior here.

(As an aside -- I find it odd you can resolve a promise multiple times...but it doesn't seem to have the same callback chain.)

主要言語
Python
スター
127
フォーク
48
平均マージ
13時間 12分
マージ済み PR(30日)
5

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

celery/vine のほかの issue

celery/vine の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。