FIX: memory exhaustion on exceptionally large message queues & multiple Queue.php invocations duplicate work
This commit is contained in:
parent
d32360cb3e
commit
b54ddccd7b
@ -62,9 +62,17 @@ class Queue {
|
|||||||
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
|
// 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.
|
// or twice a day.
|
||||||
|
|
||||||
$r = q("SELECT * FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s ",
|
$r = q("SELECT *,RAND() as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
||||||
db_utcnow()
|
db_utcnow()
|
||||||
);
|
);
|
||||||
|
while ($r) {
|
||||||
|
foreach($r as $rv) {
|
||||||
|
queue_deliver($rv);
|
||||||
|
}
|
||||||
|
$r = q("SELECT *,RAND() as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
||||||
|
db_utcnow()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(! $r)
|
if(! $r)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user