Skip to content

Commit

Permalink
fixed #18
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Feb 4, 2024
1 parent 3540aaa commit 4cac330
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/HookServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class HookServer implements ServerInterface
/** @var int|null pending处理定时器 */
protected ?int $_claimTimer = null;

/** @var array 队列分组下次claim的游标 */
protected array $claimStartTags = [];

/** @inheritDoc */
public static function getConfig(string $key, $default = null)
{
Expand Down Expand Up @@ -167,13 +170,10 @@ public function claim(string $queue, string $group, string $consumer)
if ($idArray = self::getStorage()->xAutoClaim(
$queue, $group, $consumer,
self::getConfig('pending_timeout', 60 * 60) * 1000,
'0-0', -1, true
$this->claimStartTags[$queue][$group][$consumer] ?? '0-0', -1, true
)) {
foreach ($idArray as $k => $v) {
if (!$v or $v === '0-0') {
unset($idArray[$k]);
}
}
$this->claimStartTags[$queue][$group][$consumer] = $idArray[0] ?? '0-0';
$idArray = $idArray[2] ?? [];
if ($idArray) {
if (self::getStorage()->xAck($queue, $group, $idArray)) {
self::getStorage()->xDel($queue, $idArray);
Expand Down

0 comments on commit 4cac330

Please sign in to comment.