Skip to content

Promise.all? behavior #602

@gtan66

Description

@gtan66

Hi guys!

I noticed that the implementation of Promise.all? differs from that of JavaScript's Promise.all. It seems like Promise.all? executes the promises in the argument consecutively, whereas JS's Promise.all executes them concurrently, and then resolves when all of them have completed.

Really simple examples to illustrate:

JS example: http://jsbin.com/?html,css,js,console

Ruby example:

def pr10
  Concurrent::Promise.new{
    puts "hi"
    sleep 10
    puts "bye"
  }
end

Concurrent::Promise.all?(pr10,pr10).execute

Output:
screen shot 2016-11-07 at 7 22 10 pm

Is there a reason for implementing it this way? I see that we are calling Promise.wait in the implementation here. Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAdding features, adding tests, improving documentation.not-appliedThe bug/enhacement was closed and not fixed/implemented.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions