From 1cd6049dff854a0dd0234c1ebf2bef482c7fd938 Mon Sep 17 00:00:00 2001 From: OwlyCode Date: Fri, 17 Feb 2017 11:51:08 +0100 Subject: [PATCH] Fixed ignored instances when added during await() --- src/DataLoader.php | 2 +- tests/DataLoadTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/DataLoader.php b/src/DataLoader.php index e822f0d..6e00bc5 100644 --- a/src/DataLoader.php +++ b/src/DataLoader.php @@ -290,7 +290,7 @@ private static function awaitInstances() foreach ($dataLoaders as $dataLoader) { if (!$dataLoader || !$dataLoader->needProcess()) { - $wait = false; + $wait |= false; continue; } $wait = true; diff --git a/tests/DataLoadTest.php b/tests/DataLoadTest.php index 2c27397..bffdd0a 100644 --- a/tests/DataLoadTest.php +++ b/tests/DataLoadTest.php @@ -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);