Browse Source

If a contact has had delivery issues in the last 15 minutes, send new posts straight to the queue

and don't even try to connect. Also defer polling for stuck contacts. Should reduce the number of
stuck processes trying to connect with dead or dying servers significantly.
pull/292/merge
friendica 10 years ago
parent
commit
189a31e628
  1. 2
      boot.php
  2. 11
      include/delivery.php
  3. 18
      include/diaspora.php
  4. 4
      include/onepoll.php
  5. 9
      include/queue_fn.php
  6. 477
      util/messages.po

2
boot.php

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1334' );
define ( 'FRIENDICA_VERSION', '2.3.1335' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1143 );

11
include/delivery.php

@ -347,7 +347,10 @@ function delivery_run($argv, $argc){
}
}
$deliver_status = dfrn_deliver($owner,$contact,$atom);
if(! was_recently_delayed($contact['id']))
$deliver_status = dfrn_deliver($owner,$contact,$atom);
else
$deliver_status = (-1);
logger('notifier: dfrn_delivery returns ' . $deliver_status);
@ -390,7 +393,11 @@ function delivery_run($argv, $argc){
logger('notifier: slapdelivery: ' . $contact['name']);
foreach($slaps as $slappy) {
if($contact['notify']) {
$deliver_status = slapper($owner,$contact['notify'],$slappy);
if(! was_recently_delayed($contact['id']))
$deliver_status = slapper($owner,$contact['notify'],$slappy);
else
$deliver_status = (-1);
if($deliver_status == (-1)) {
// queue message for redelivery
add_to_queue($contact['id'],NETWORK_OSTATUS,$slappy);

18
include/diaspora.php

@ -2298,14 +2298,20 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch) {
logger('diaspora_transmit: ' . $logid . ' ' . $dest_url);
if(! intval(get_config('system','diaspora_test')))
post_url($dest_url . '/', $slap);
if(was_recently_delayed($contact['id'])) {
$return_code = 0;
}
else {
logger('diaspora_transmit: test_mode');
return 200;
if(! intval(get_config('system','diaspora_test'))) {
post_url($dest_url . '/', $slap);
$return_code = $a->get_curl_code();
}
else {
logger('diaspora_transmit: test_mode');
return 200;
}
}
$return_code = $a->get_curl_code();
logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code);
if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {

4
include/onepoll.php

@ -25,6 +25,7 @@ function onepoll_run($argv, $argc){
require_once('include/email.php');
require_once('include/socgraph.php');
require_once('include/pidfile.php');
require_once('include/queue_fn.php');
load_config('config');
load_config('system');
@ -54,6 +55,9 @@ function onepoll_run($argv, $argc){
return;
}
if(was_recently_delayed($contact_id))
return;
$d = datetime_convert();
// Only poll from those with suitable relationships,

9
include/queue_fn.php

@ -15,6 +15,15 @@ function remove_queue_item($id) {
);
}
function was_recently_delayed($cid) {
$r = q("SELECT `id` FROM `queue` WHERE `cid` = %d
and last > UTC_TIMESTAMP() - interval 15 minute limit 1",
intval($cid)
);
}
function add_to_queue($cid,$network,$msg,$batch = false) {

477
util/messages.po
File diff suppressed because it is too large
View File

Loading…
Cancel
Save