Skip to content

Commit

Permalink
Merge branch 'master' into 3.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/support/tests/FunctionTest.php
  • Loading branch information
limingxinleo committed Nov 10, 2023
2 parents a03ea95 + 7ff3692 commit 434943e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Driver/RedisDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function push(JobInterface $job, int $delay = 0): bool
return (bool) $this->redis->lPush($this->channel->getWaiting(), $data);
}

return $this->redis->zAdd($this->channel->getDelayed(), time() + $delay, $data) > 0;
return (bool) $this->redis->zAdd($this->channel->getDelayed(), time() + $delay, $data);
}

public function delete(JobInterface $job): bool
Expand Down Expand Up @@ -152,7 +152,7 @@ protected function retry(MessageInterface $message): bool

$delay = time() + $this->getRetrySeconds($message->getAttempts());

return $this->redis->zAdd($this->channel->getDelayed(), $delay, $data) > 0;
return (bool) $this->redis->zAdd($this->channel->getDelayed(), $delay, $data);
}

protected function getRetrySeconds(int $attempts): int
Expand All @@ -173,7 +173,7 @@ protected function getRetrySeconds(int $attempts): int
*/
protected function remove(mixed $data): bool
{
return $this->redis->zrem($this->channel->getReserved(), (string) $data) > 0;
return (bool) $this->redis->zrem($this->channel->getReserved(), (string) $data);
}

/**
Expand All @@ -185,7 +185,7 @@ protected function move(string $from, string $to): void
$options = ['LIMIT' => [0, 100]];
if ($expired = $this->redis->zrevrangebyscore($from, (string) $now, '-inf', $options)) {
foreach ($expired as $job) {
if ($this->redis->zRem($from, $job) > 0) {
if ($this->redis->zRem($from, $job)) {
$this->redis->lPush($to, $job);
}
}
Expand Down

0 comments on commit 434943e

Please sign in to comment.