@@ -11,14 +11,14 @@ |
||
| 11 | 11 | $wrapped = serialize($object); |
| 12 | 12 | |
| 13 | 13 | $allQueues = new RedisTtlSortedSet('redisQ:allQueues'); |
| 14 | - $objectQueues = new RedisTtlSortedSet('objectQueues'); |
|
| 14 | + $objectQueues = new RedisTtlSortedSet('objectQueues'); |
|
| 15 | 15 | $queues = $allQueues->getMembers(); |
| 16 | 16 | |
| 17 | 17 | $multi = $redis->multi(); |
| 18 | 18 | |
| 19 | 19 | // Store an instance of the object |
| 20 | 20 | $objectID = 'redisQ:objectID:'.uniqID().md5($wrapped); |
| 21 | - $objectQueues->add(time(), $objectID); |
|
| 21 | + $objectQueues->add(time(), $objectID); |
|
| 22 | 22 | $multi->setex($objectID, 9600, $wrapped); |
| 23 | 23 | |
| 24 | 24 | // Add objectID to all queues |
@@ -52,7 +52,9 @@ |
||
| 52 | 52 | |
| 53 | 53 | $objectID = $pop[1]; |
| 54 | 54 | $object = $redis->get($objectID); |
| 55 | - if ($object === false) return listen($queueID, $timeToWait); |
|
| 55 | + if ($object === false) { |
|
| 56 | + return listen($queueID, $timeToWait); |
|
| 57 | + } |
|
| 56 | 58 | |
| 57 | 59 | return unserialize($object); |
| 58 | 60 | } |
@@ -11,10 +11,14 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | $ttw = (int) @$_GET['ttw']; |
| 14 | -if ($ttw == 0) $ttw = 10; |
|
| 14 | +if ($ttw == 0) { |
|
| 15 | + $ttw = 10; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | $package = unserialize(RedisQ\RedisQ::listen($queueID, $ttw)); |
| 17 | -if ($package === false) $package = null; |
|
| 19 | +if ($package === false) { |
|
| 20 | + $package = null; |
|
| 21 | +} |
|
| 18 | 22 | |
| 19 | 23 | $response = ['package' => $package]; |
| 20 | 24 | header("Access-Control-Allow-Origin: *"); |