Re: Need guidance on promise-returning methods on a stateful object

(Jumping in)

On 10/16/15 1:13 PM, Anne van Kesteren wrote:
> On Fri, Oct 16, 2015 at 6:55 PM, Adam Bergkvist
> <adam.bergkvist@ericsson.com> wrote:
>> Here's a simplified description of the algorithm. I hope it clarifies
>> where things live.
>>
>> 1. Let p be a new promise.
>> 2. In paralell, do 'install configuration'.
>>     1. If 'install configuration' completes successfully, queue a task to
>> run the following steps:
>>       1. (possibly check for closed state, reject p and abort?)
>>       2. Resolve p with undefined.
>> 3. Return p.
>>
>> So while the 'install configuration' processing is going on in some
>> other thread (not main), the instance might go to the closed state. When
>> that happens, you can't really do anything else with the instance
>> besides reading some attributes. So when this happens, should we reject
>> all pending promises, or just leave them be?
> In the abstract, what I don't understand is why the state transition
> to closed wouldn't terminate any existing algorithms. (You didn't
> really clarify on how the state transition happens and where that
> change process lives.)

In at least one implementation the transition to closed does terminate 
existing algorithms, but the question remains whether to reject promises 
at that point or stay silent.

.: Jan-Ivar :.

Received on Monday, 19 October 2015 19:17:43 UTC