Skip to content

Commit

Permalink
Fixed ignored instances when added during await()
Browse files Browse the repository at this point in the history
  • Loading branch information
OwlyCode committed Feb 17, 2017
1 parent 424ca96 commit 1cd6049
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/DataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private static function awaitInstances()

foreach ($dataLoaders as $dataLoader) {
if (!$dataLoader || !$dataLoader->needProcess()) {
$wait = false;
$wait |= false;
continue;
}
$wait = true;
Expand Down
5 changes: 5 additions & 0 deletions tests/DataLoadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,11 @@ public function testAwaitAlsoAwaitsNewlyCreatedDataloaders()
return self::$promiseAdapter->createAll(['A']);
}, self::$promiseAdapter);

// This tests that an idling dataloader do not cause the others to be skipped.
$third = new DataLoader(function () {
// noop
}, self::$promiseAdapter);

DataLoader::await($first->load('A'));

$this->assertTrue($firstComplete);
Expand Down

0 comments on commit 1cd6049

Please sign in to comment.