Skip to content

Commit

Permalink
Merge pull request #14 from OwlyCode/fix-ignored-instances
Browse files Browse the repository at this point in the history
Fixed ignored instances when added during await()
  • Loading branch information
mcg-web authored Feb 17, 2017
2 parents 424ca96 + 1cd6049 commit 0fdf3ca
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 0fdf3ca

Please sign in to comment.