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.)
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
EagerResultin celery you end up with something like this: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
Deferredalready 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.)