Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Issue 9108010: Futures.wait should call then, even if some(or all) of the futures are done (Closed)

Created:
8 years, 11 months ago by Anders Johnsen
Modified:
8 years, 11 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Futures.wait should call then, even if some(or all) of the futures are done Committed: https://code.google.com/p/dart/source/detail?r=3033

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 4

Patch Set 3 : '' #

Total comments: 11

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+61 lines, -9 lines) Patch
M corelib/src/future.dart View 1 2 1 chunk +20 lines, -9 lines 2 comments Download
A tests/corelib/src/FuturesTest.dart View 1 2 3 4 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Anders Johnsen
8 years, 11 months ago (2012-01-05 12:42:48 UTC) #1
kasperl
Adding Siggi as a reviewer (hope that's okay).
8 years, 11 months ago (2012-01-05 17:09:49 UTC) #2
kasperl
Thanks a lot for doing this, Anders. LGTM if you add a test case that ...
8 years, 11 months ago (2012-01-06 08:17:53 UTC) #3
Anders Johnsen
I've attached a test file. Let me know if you find it sufficient. Thank you! ...
8 years, 11 months ago (2012-01-06 08:57:09 UTC) #4
kasperl
http://codereview.chromium.org/9108010/diff/5003/tests/corelib/src/FuturesTest.dart File tests/corelib/src/FuturesTest.dart (right): http://codereview.chromium.org/9108010/diff/5003/tests/corelib/src/FuturesTest.dart#newcode17 tests/corelib/src/FuturesTest.dart:17: Expect.equals(list.length, 3); Weird indentation. Emacs user? http://codereview.chromium.org/9108010/diff/5003/tests/corelib/src/FuturesTest.dart#newcode17 tests/corelib/src/FuturesTest.dart:17: Expect.equals(list.length, ...
8 years, 11 months ago (2012-01-06 09:06:46 UTC) #5
Anders Johnsen
Let me know if you still want me to remove the class from the test ...
8 years, 11 months ago (2012-01-06 09:28:32 UTC) #6
Anders Johnsen
Removed surrounding class and committed, thank you!
8 years, 11 months ago (2012-01-06 12:42:17 UTC) #7
Siggi Cherem (dart-lang)
http://codereview.chromium.org/9108010/diff/11002/corelib/src/future.dart File corelib/src/future.dart (right): http://codereview.chromium.org/9108010/diff/11002/corelib/src/future.dart#newcode135 corelib/src/future.dart:135: if (futures[i].isComplete) { (sorry for the slow reply I ...
8 years, 11 months ago (2012-01-10 18:56:43 UTC) #8
Anders Johnsen
8 years, 11 months ago (2012-01-10 19:21:39 UTC) #9
http://codereview.chromium.org/9108010/diff/11002/corelib/src/future.dart
File corelib/src/future.dart (right):

http://codereview.chromium.org/9108010/diff/11002/corelib/src/future.dart#new...
corelib/src/future.dart:135: if (futures[i].isComplete) {
On 2012/01/10 18:56:43, sigmund wrote:
> (sorry for the slow reply I was OOO until today)
> 
> We might be able to simplify this change slightly.
> 
> We need overall more tests for this code (thanks for the new tests!), but I
> believe many of the tests you added, except [testWaitEmpty] worked before your
> change too. I believe all other test were passing before because [Future.then]
> internally calls the complete handler immediately if the future is already
> completed (basically the same code you have inlined here in this branch).
> 
> I believe we can simplify this by removing this conditional (reverting the
body
> of the loop as before), but changing line 152 below to say 'futures.length ==
0'
> rather than 'remaining == 0'.

I was having problems with futures being complete not responding, so I'll
investigate that a bit further.

And yes, that is a nicer way to write it.

Thank you for the review!

Powered by Google App Engine
This is Rietveld 408576698