aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/queue.php16
-rw-r--r--include/queue_fn.php25
-rw-r--r--include/zot.php16
3 files changed, 28 insertions, 29 deletions
diff --git a/include/queue.php b/include/queue.php
index 71ac50c83..5c3376661 100644
--- a/include/queue.php
+++ b/include/queue.php
@@ -114,20 +114,17 @@ function queue_run($argv, $argc){
dbesc(datetime_convert()),
dbesc($rr['outq_hash'])
);
- $y = q("delete from outq where outq_hash = '%s'",
- dbesc($rr['outq_hash'])
- );
+ remove_queue_item($rr['outq_hash']);
}
else {
logger('queue: queue post returned ' . $result['return_code'] . ' from ' . $rr['outq_posturl'],LOGGER_DEBUG);
- $y = q("update outq set outq_updated = '%s', outq_priority = outq_priority + 10 where outq_hash = '%s'",
- dbesc(datetime_convert()),
- dbesc($rr['outq_hash'])
- );
+ update_queue_item($rr['outq_hash'],10);
$deadguys[] = $rr['outq_posturl'];
}
continue;
}
+
+
$result = zot_zot($rr['outq_posturl'],$rr['outq_notify']);
if($result['success']) {
logger('queue: deliver zot success to ' . $rr['outq_posturl'], LOGGER_DEBUG);
@@ -136,10 +133,7 @@ function queue_run($argv, $argc){
else {
$deadguys[] = $rr['outq_posturl'];
logger('queue: deliver zot returned ' . $result['return_code'] . ' from ' . $rr['outq_posturl'],LOGGER_DEBUG);
- $y = q("update outq set outq_updated = '%s', outq_priority = outq_priority + 10 where outq_hash = '%s'",
- dbesc(datetime_convert()),
- dbesc($rr['outq_hash'])
- );
+ update_queue_item($rr['outq_hash'],10);
}
}
}
diff --git a/include/queue_fn.php b/include/queue_fn.php
index 41001bb19..5c6570f66 100644
--- a/include/queue_fn.php
+++ b/include/queue_fn.php
@@ -1,16 +1,29 @@
<?php /** @file */
-function update_queue_time($id) {
- logger('queue: requeue item ' . $id);
- q("UPDATE outq SET outq_updated = '%s' WHERE outq_hash = '%s'",
+function update_queue_time($id, $add_priority = 0) {
+ logger('queue: requeue item ' . $id,LOGGER_DEBUG);
+ q("UPDATE outq SET outq_updated = '%s', outq_priority = outq_priority + %d WHERE outq_hash = '%s'",
dbesc(datetime_convert()),
+ intval($add_priority),
dbesc($id)
);
}
-function remove_queue_item($id) {
- logger('queue: remove queue item ' . $id);
- q("DELETE FROM outq WHERE hash = '%s'",
+function remove_queue_item($id,$channel_id = 0) {
+ logger('queue: remove queue item ' . $id,LOGGER_DEBUG);
+ $sql_extra = (($channel_id) ? " and outq_channel = " . intval($channel_id) . " " : '');
+
+ q("DELETE FROM outq WHERE outq_hash = '%s' $sql_extra",
+ dbesc($id)
+ );
+}
+
+function queue_set_delivered($id,$channel = 0) {
+ logger('queue: set delivered ' . $id,LOGGER_DEBUG);
+ $sql_extra = (($channel_id) ? " and outq_channel = " . intval($channel_id) . " " : '');
+
+ q("update outq set outq_delivered = 1, outq_updated = '%s' where outq_hash = '%s' $sql_extra ",
+ dbesc(datetime_convert()),
dbesc($id)
);
}
diff --git a/include/zot.php b/include/zot.php
index 6655f1c2c..8f8e70159 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -998,6 +998,8 @@ function zot_process_response($hub, $arr, $outq) {
}
}
+ // we have a more descriptive delivery report, so discard the per hub 'queued' report.
+
q("delete from dreport where dreport_queue = '%s' limit 1",
dbesc($outq['outq_hash'])
);
@@ -1012,18 +1014,8 @@ function zot_process_response($hub, $arr, $outq) {
// synchronous message types are handled immediately
// async messages remain in the queue until processed.
- if (intval($outq['outq_async'])) {
- q("update outq set outq_delivered = 1, outq_updated = '%s' where outq_hash = '%s' and outq_channel = %d",
- dbesc(datetime_convert()),
- dbesc($outq['outq_hash']),
- intval($outq['outq_channel'])
- );
- } else {
- q("delete from outq where outq_hash = '%s' and outq_channel = %d",
- dbesc($outq['outq_hash']),
- intval($outq['outq_channel'])
- );
- }
+ if(intval($outq['outq_async']))
+ queue_set_delivered($outq['outq_hash'],$outq['outq_channel']);
logger('zot_process_response: ' . print_r($x,true), LOGGER_DEBUG);
}