提交 8cdfd320 编写于 作者: weixin_47267244's avatar weixin_47267244

优化代码格式

上级 38b15784
......@@ -645,8 +645,7 @@ class AMQPQueueDriver implements IQueueDriver
-- 从工作队列删除
redis.call('zrem', KEYS[1], unpack(messages))
return messages
LUA
, [
LUA, [
$this->getRedisQueueKey(QueueType::WORKING),
microtime(true),
$count,
......@@ -690,8 +689,7 @@ class AMQPQueueDriver implements IQueueDriver
else
return redis.call('sismember', deletedKey, messageId);
end
LUA
, [
LUA, [
$this->getRedisQueueKey('deleted'),
$messageId,
$delete,
......
......@@ -101,8 +101,7 @@ class RedisQueueDriver implements IQueueDriver
-- 加入延时队列
redis.call('zadd', queueKey, delayTo, messageId);
return messageId
LUA
, $args, 3);
LUA, $args, 3);
}
else
{
......@@ -139,8 +138,7 @@ class RedisQueueDriver implements IQueueDriver
-- 加入队列
redis.call('rpush', queueKey, messageId);
return messageId
LUA
, $args, 3);
LUA, $args, 3);
}
if (false === $result)
{
......@@ -202,8 +200,7 @@ class RedisQueueDriver implements IQueueDriver
end
redis.call('zadd', KEYS[2], ARGV[1] + score, messageId)
return hashResult
LUA
, [
LUA, [
$this->getQueueKey(QueueType::READY),
$this->getQueueKey(QueueType::WORKING),
$this->getMessageKeyPrefix(),
......@@ -260,8 +257,7 @@ class RedisQueueDriver implements IQueueDriver
end
end
return true
LUA
, [
LUA, [
$this->getQueueKey(QueueType::READY),
$this->getQueueKey(QueueType::DELAY),
$this->getMessageKeyPrefix(),
......@@ -318,8 +314,7 @@ class RedisQueueDriver implements IQueueDriver
-- 删除消息
redis.call('del', KEYS[2] .. ARGV[1])
return true
LUA
, [
LUA, [
$this->getQueueKey(QueueType::WORKING),
$this->getMessageKeyPrefix(),
$this->getQueueKey(QueueType::TIMEOUT),
......@@ -366,8 +361,7 @@ class RedisQueueDriver implements IQueueDriver
redis.call('zrem', KEYS[1], ARGV[1])
{$operation}
return true
LUA
, [
LUA, [
$this->getQueueKey(QueueType::WORKING),
$requeue ? $this->getQueueKey(QueueType::READY) : $this->getQueueKey(QueueType::FAIL),
$message->getMessageId(),
......@@ -428,8 +422,7 @@ class RedisQueueDriver implements IQueueDriver
result = result + 1
end
return result
LUA
, [
LUA, [
$this->getQueueKey(QueueType::READY),
$this->getQueueKey(QueueType::FAIL),
], 2);
......@@ -462,8 +455,7 @@ class RedisQueueDriver implements IQueueDriver
result = result + 1
end
return result
LUA
, [
LUA, [
$this->getQueueKey(QueueType::READY),
$this->getQueueKey(QueueType::TIMEOUT),
], 2);
......@@ -503,8 +495,7 @@ class RedisQueueDriver implements IQueueDriver
-- 从延时队列删除
redis.call('zrem', KEYS[2], unpack(messageIds))
return messageIdCount
LUA
, [
LUA, [
$this->getQueueKey(QueueType::READY),
$this->getQueueKey(QueueType::DELAY),
microtime(true),
......@@ -546,8 +537,7 @@ class RedisQueueDriver implements IQueueDriver
-- 从工作队列删除
redis.call('zrem', KEYS[1], unpack(messageIds))
return messageIdCount
LUA
, [
LUA, [
$this->getQueueKey(QueueType::WORKING),
$this->getQueueKey(QueueType::TIMEOUT),
microtime(true),
......
......@@ -61,8 +61,7 @@ abstract class WorkerLimiterLock
return false
end
return id
SCRIPT
, $args, $numKeys);
SCRIPT, $args, $numKeys);
if (!$result && '' !== ($error = $redis->getLastError()))
{
throw new \RuntimeException($error);
......@@ -96,8 +95,7 @@ abstract class WorkerLimiterLock
return redis.call('decr', name) >= 0
end
return false
SCRIPT
, $args, $numKeys);
SCRIPT, $args, $numKeys);
if (!$result && '' !== ($error = $redis->getLastError()))
{
throw new \RuntimeException($error);
......
......@@ -109,8 +109,7 @@ class Redis extends BaseLock
end
end
return lockSet
SCRIPT
, [
SCRIPT, [
$this->key,
$this->guid,
$this->db,
......@@ -137,8 +136,7 @@ class Redis extends BaseLock
return redis.call('del', key);
end
return 0
SCRIPT
, [
SCRIPT, [
$this->key,
$this->guid,
$this->db,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册