For example, the project uses the redis list queue. when rpop is used to obtain data, it sometimes returns a value similar to: 1. the portal is found in the issues list of phpredis on github, the project uses version 2.2.7. Is there a solution for similar problems? For example, the project uses
redisOf
listQueue, use
rpopWhen obtaining data, it sometimes returns
:1In
githubOf
phpredisOf
issuesThe portal is found in the list. the version used by the project is
2.2.7Version. Is there a solution for similar problems?
Reply content:
For example, the project usesredisOflistQueue, userpopWhen obtaining data, it sometimes returns:1IngithubOfphpredisOfissuesThe portal is found in the list. the version used by the project is2.2.7Version. Is there a solution for similar problems?
Code on
while (true) { $list = $redis->blpop(DXKey::getKeyOfRunnerEmailTaskListPending(), 6); if (is_array($list) && count($list) == 2) { DXUtil::consoleLog(DXUtil::jsonEncode($list)); $payload = $list[1]; DXUtil::consoleLog('pop: ' . $payload); $task = @json_decode($payload, true); MailTaskRunner::runEmailTask($task); } }
Execution result
2016-11-23 19:23:07 start2016-11-23 19:23:08 ["runner.email.task.list.pending","{\"time\":1479900188,\"type\":1,\"data\":{\"to_address\":\"wqcsimple@foxmail.com\",\"task_id\":1}}"]2016-11-23 19:23:08 pop: {"time":1479900188,"type":1,"data":{"to_address":"wqcsimple@foxmail.com","task_id":1}}2016-11-23 19:23:08 send success