Skip to content

Commit

Permalink
Optimize navbar (#6266)
Browse files Browse the repository at this point in the history
Co-authored-by: 李铭昕 <[email protected]>
  • Loading branch information
sy-records and limingxinleo authored Nov 7, 2023
1 parent b7976f7 commit 7ff3692
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 @@ -64,7 +64,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 @@ -153,7 +153,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 @@ -174,7 +174,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 @@ -186,7 +186,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 7ff3692

Please sign in to comment.