remove item from queue

This commit is contained in:
Friendika 2011-08-28 22:59:49 -07:00
parent 846c4cea7c
commit b61d535f81
2 changed files with 23 additions and 11 deletions

View file

@ -37,6 +37,19 @@ function delivery_run($argv, $argc){
$item_id = intval($argv[2]); $item_id = intval($argv[2]);
$contact_id = intval($argv[3]); $contact_id = intval($argv[3]);
// Some other process may have delivered this item already.
$r = q("select * from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",
dbesc($cmd),
dbesc($item_id),
dbesc($contact_id)
);
if(! count($r)) {
return;
}
// It's ours to deliver. Remove it from the queue.
q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1", q("delete from deliverq where cmd = '%s' and item = %d and contact = %d limit 1",
dbesc($cmd), dbesc($cmd),
dbesc($item_id), dbesc($item_id),

View file

@ -42,7 +42,6 @@ function queue_run($argv, $argc){
if(! $interval) if(! $interval)
$interval = 2; $interval = 2;
$r = q("select * from deliverq where 1"); $r = q("select * from deliverq where 1");
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {