diff --git a/src/Utils/WaitGroup/Handlers/SwooleWaitGroup.php b/src/Utils/WaitGroup/Handlers/SwooleWaitGroup.php index c745bdf..6129dc2 100644 --- a/src/Utils/WaitGroup/Handlers/SwooleWaitGroup.php +++ b/src/Utils/WaitGroup/Handlers/SwooleWaitGroup.php @@ -37,7 +37,7 @@ public function __destruct() /** @inheritdoc */ public function add(int $delta = 1): bool { - $this->_waitGroup->add($delta); + $this->_waitGroup->add(max($delta, 1)); return true; } @@ -45,7 +45,9 @@ public function add(int $delta = 1): bool /** @inheritdoc */ public function done(): bool { - $this->_waitGroup->done(); + if ($this->count() > 0) { + $this->_waitGroup->done(); + } return true; }