Skip to content

Commit cbf5264

Browse files
committed
fix delay queue
1 parent db37fa4 commit cbf5264

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/Client.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,17 @@ public function send($queue, $data, $delay = 0, $cb = null)
113113
$cb = function ($ret) use ($cb) {
114114
$cb((bool)$ret);
115115
};
116+
if ($delay == 0) {
117+
$this->_redisSend->lPush(static::QUEUE_WAITING . $queue, $package_str, $cb);
118+
} else {
119+
$this->_redisSend->zAdd(static::QUEUE_DELAYED, $now + $delay, $package_str, $cb);
120+
}
121+
return;
116122
}
117123
if ($delay == 0) {
118-
$this->_redisSend->lPush(static::QUEUE_WAITING . $queue, $package_str, $cb);
124+
$this->_redisSend->lPush(static::QUEUE_WAITING . $queue, $package_str);
119125
} else {
120-
$this->_redisSend->zAdd(static::QUEUE_DELAYED, $now + $delay, $package_str, $cb);
126+
$this->_redisSend->zAdd(static::QUEUE_DELAYED, $now + $delay, $package_str);
121127
}
122128
}
123129

0 commit comments

Comments
 (0)