aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-01-11 20:03:34 +0100
committerMario <mario@mariovavti.com>2019-01-11 20:03:34 +0100
commitf6f4e40a64c771072d0c2425e9cf2f5f42c6cd3e (patch)
tree6a1a107cf33474a5c9350f4f542f9c7c1978c2d1
parentdc8da4717f59c850633469d2ece792e04c02b834 (diff)
parentcaf2c0a6c43f3162fc8f4d758eb06cb2f56b3865 (diff)
downloadvolse-hubzilla-f6f4e40a64c771072d0c2425e9cf2f5f42c6cd3e.tar.gz
volse-hubzilla-f6f4e40a64c771072d0c2425e9cf2f5f42c6cd3e.tar.bz2
volse-hubzilla-f6f4e40a64c771072d0c2425e9cf2f5f42c6cd3e.zip
Merge branch 'patch-20190110a' into 'dev'
FIX: memory exhaustion on exceptionally large message queues & multiple... See merge request hubzilla/core!1465
-rw-r--r--Zotlabs/Daemon/Queue.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/Zotlabs/Daemon/Queue.php b/Zotlabs/Daemon/Queue.php
index 8f529ff13..814148404 100644
--- a/Zotlabs/Daemon/Queue.php
+++ b/Zotlabs/Daemon/Queue.php
@@ -12,7 +12,6 @@ class Queue {
require_once('include/items.php');
require_once('include/bbcode.php');
-
if($argc > 1)
$queue_id = $argv[1];
else
@@ -61,10 +60,20 @@ class Queue {
// or just prior to this query based on recent and long-term delivery history. If we have good reason to believe
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
// or twice a day.
-
- $r = q("SELECT * FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s ",
+
+ $sqlrandfunc = db_getfunc('rand');
+
+ $r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
db_utcnow()
);
+ while ($r) {
+ foreach($r as $rv) {
+ queue_deliver($rv);
+ }
+ $r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
+ db_utcnow()
+ );
+ }
}
if(! $r)
return;