Skip to content

Commit

Permalink
fix WaitGroup misuse: negative counter
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Nov 8, 2024
1 parent 6f7554f commit bad1925
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Utils/WaitGroup/Handlers/SwooleWaitGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ public function __destruct()
/** @inheritdoc */
public function add(int $delta = 1): bool
{
$this->_waitGroup->add($delta);
$this->_waitGroup->add(max($delta, 1));

return true;
}

/** @inheritdoc */
public function done(): bool
{
$this->_waitGroup->done();
if ($this->count() > 0) {
$this->_waitGroup->done();
}

return true;
}
Expand Down

0 comments on commit bad1925

Please sign in to comment.