Skip to content

Commit

Permalink
fixed claim error
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Feb 1, 2024
1 parent d7d4a28 commit 15a6a72
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/HookServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,20 @@ public function ack(string $queue, string $group, array $idArray): bool
public function claim(string $queue, string $group, string $consumer)
{
try {
$idArray = self::getStorage()->xAutoClaim(
if ($idArray = self::getStorage()->xAutoClaim(
$queue, $group, $consumer,
self::getConfig('pending_timeout', 60 * 60) * 1000,
'0-0', -1, true
);
foreach ($idArray as $k => $v) {
if (!$v or $v === '0-0') {
unset($idArray[$k]);
)) {
foreach ($idArray as $k => $v) {
if (!$v or $v === '0-0') {
unset($idArray[$k]);
}
}
}
if ($idArray) {
if (self::getStorage()->xAck($queue, $group, $idArray)) {
self::getStorage()->xDel($queue, $idArray);
if ($idArray) {
if (self::getStorage()->xAck($queue, $group, $idArray)) {
self::getStorage()->xDel($queue, $idArray);
}
}
}
} catch (RedisException $exception) {
Expand Down Expand Up @@ -225,7 +226,6 @@ public function consumer(string $queue, string $group, string $consumer, int $bl
]);
throw new Exception($throwable->getMessage(), $throwable->getCode(), $throwable);
}

}
} catch (RedisException $exception) {
Log::channel('plugin.workbunny.webman-push-server.warning')->warning('Storage consumer error. ', [
Expand Down

0 comments on commit 15a6a72

Please sign in to comment.