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.
This commit is contained in:
parent
e8b9b8a403
commit
189a31e628
2
boot.php
2
boot.php
|
@ -9,7 +9,7 @@ require_once('include/nav.php');
|
||||||
require_once('include/cache.php');
|
require_once('include/cache.php');
|
||||||
|
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_VERSION', '2.3.1334' );
|
define ( 'FRIENDICA_VERSION', '2.3.1335' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1143 );
|
define ( 'DB_UPDATE_VERSION', 1143 );
|
||||||
|
|
||||||
|
|
|
@ -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);
|
logger('notifier: dfrn_delivery returns ' . $deliver_status);
|
||||||
|
|
||||||
|
@ -390,7 +393,11 @@ function delivery_run($argv, $argc){
|
||||||
logger('notifier: slapdelivery: ' . $contact['name']);
|
logger('notifier: slapdelivery: ' . $contact['name']);
|
||||||
foreach($slaps as $slappy) {
|
foreach($slaps as $slappy) {
|
||||||
if($contact['notify']) {
|
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)) {
|
if($deliver_status == (-1)) {
|
||||||
// queue message for redelivery
|
// queue message for redelivery
|
||||||
add_to_queue($contact['id'],NETWORK_OSTATUS,$slappy);
|
add_to_queue($contact['id'],NETWORK_OSTATUS,$slappy);
|
||||||
|
|
|
@ -2298,14 +2298,20 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch) {
|
||||||
|
|
||||||
logger('diaspora_transmit: ' . $logid . ' ' . $dest_url);
|
logger('diaspora_transmit: ' . $logid . ' ' . $dest_url);
|
||||||
|
|
||||||
if(! intval(get_config('system','diaspora_test')))
|
if(was_recently_delayed($contact['id'])) {
|
||||||
post_url($dest_url . '/', $slap);
|
$return_code = 0;
|
||||||
else {
|
|
||||||
logger('diaspora_transmit: test_mode');
|
|
||||||
return 200;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
$return_code = $a->get_curl_code();
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code);
|
logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code);
|
||||||
|
|
||||||
if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {
|
if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ function onepoll_run($argv, $argc){
|
||||||
require_once('include/email.php');
|
require_once('include/email.php');
|
||||||
require_once('include/socgraph.php');
|
require_once('include/socgraph.php');
|
||||||
require_once('include/pidfile.php');
|
require_once('include/pidfile.php');
|
||||||
|
require_once('include/queue_fn.php');
|
||||||
|
|
||||||
load_config('config');
|
load_config('config');
|
||||||
load_config('system');
|
load_config('system');
|
||||||
|
@ -54,6 +55,9 @@ function onepoll_run($argv, $argc){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(was_recently_delayed($contact_id))
|
||||||
|
return;
|
||||||
|
|
||||||
$d = datetime_convert();
|
$d = datetime_convert();
|
||||||
|
|
||||||
// Only poll from those with suitable relationships,
|
// Only poll from those with suitable relationships,
|
||||||
|
|
|
@ -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) {
|
function add_to_queue($cid,$network,$msg,$batch = false) {
|
||||||
|
|
||||||
|
|
485
util/messages.po
485
util/messages.po
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue