diff options
author | Friendika <info@friendika.com> | 2010-11-22 15:30:52 -0800 |
---|---|---|
committer | Friendika <info@friendika.com> | 2010-11-22 15:30:52 -0800 |
commit | fb58801aa406d1dd250d614b02f63f0b72bae6b6 (patch) | |
tree | 27d424ba57d06e09d29dac874880768c530a1d22 | |
parent | 0bcb68200e8543dbcaaea16aae86806b6251ebb4 (diff) | |
download | volse-hubzilla-fb58801aa406d1dd250d614b02f63f0b72bae6b6.tar.gz volse-hubzilla-fb58801aa406d1dd250d614b02f63f0b72bae6b6.tar.bz2 volse-hubzilla-fb58801aa406d1dd250d614b02f63f0b72bae6b6.zip |
schedule the queue re-delivery process
-rw-r--r-- | include/notifier.php | 26 | ||||
-rw-r--r-- | include/poller.php | 7 | ||||
-rw-r--r-- | include/queue.php | 2 |
3 files changed, 30 insertions, 5 deletions
diff --git a/include/notifier.php b/include/notifier.php index bbc4f0047..dde538a6b 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -258,7 +258,13 @@ if($deliver_status == (-1)) { // queue message for redelivery - + q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`) + VALUES ( %d, '%s', '%s', '%s') ", + intval($contact['id']), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc($atom) + ); } break; @@ -269,6 +275,13 @@ if($deliver_status == (-1)) { // queue message for redelivery + q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`) + VALUES ( %d, '%s', '%s', '%s') ", + intval($contact['id']), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc($slap) + ); } @@ -286,9 +299,13 @@ $deliver_status = slapper($owner,$contact['notify'],$slappy); if($deliver_status == (-1)) { // queue message for redelivery - // if not already in queue - // else if deliver_status ok and queued, remove from queue - + q("INSERT INTO `queue` ( `cid`, `created`, `last`, `content`) + VALUES ( %d, '%s', '%s', '%s') ", + intval($contact['id']), + dbesc(datetime_convert()), + dbesc(datetime_convert()), + dbesc($slappy) + ); } } } @@ -314,6 +331,7 @@ foreach($slaps as $slappy) { if($url) { $deliver_status = slapper($owner,$url,$slappy); + // TODO: redeliver/queue these items on failure, though there is no contact record } } } diff --git a/include/poller.php b/include/poller.php index a34a1e01f..a9c1a28ca 100644 --- a/include/poller.php +++ b/include/poller.php @@ -18,6 +18,13 @@ $a->set_baseurl(get_config('system','url')); + + // run queue delivery process in the background + + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); + proc_close(proc_open("\"$php_path\" \"include/queue.php\" &", array(), $foo)); + + $force = false; if(($argc > 1) && ($argv[1] == 'force')) $force = true; diff --git a/include/queue.php b/include/queue.php index b7fb478b4..7df510ef4 100644 --- a/include/queue.php +++ b/include/queue.php @@ -45,7 +45,7 @@ function remove_queue_item($id) { q("DELETE FROM `queue` WHERE `created` < UTC_TIMESTAMP() - INTERVAL 3 DAY"); } - $r = q("SELECT `id` FROM `queue` WHERE 1 "); + $r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE "); if(! count($r)) killme(); |