Skip to content

Commit 0fdf3ca

Browse files
authored
Merge pull request #14 from OwlyCode/fix-ignored-instances
Fixed ignored instances when added during await()
2 parents 424ca96 + 1cd6049 commit 0fdf3ca

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/DataLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private static function awaitInstances()
290290

291291
foreach ($dataLoaders as $dataLoader) {
292292
if (!$dataLoader || !$dataLoader->needProcess()) {
293-
$wait = false;
293+
$wait |= false;
294294
continue;
295295
}
296296
$wait = true;

tests/DataLoadTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,11 @@ public function testAwaitAlsoAwaitsNewlyCreatedDataloaders()
803803
return self::$promiseAdapter->createAll(['A']);
804804
}, self::$promiseAdapter);
805805

806+
// This tests that an idling dataloader do not cause the others to be skipped.
807+
$third = new DataLoader(function () {
808+
// noop
809+
}, self::$promiseAdapter);
810+
806811
DataLoader::await($first->load('A'));
807812

808813
$this->assertTrue($firstComplete);

0 commit comments

Comments
 (0)