reduce polling load

This commit is contained in:
Friendika 2011-11-04 15:21:46 -07:00
parent 2765b0ba41
commit a203820efe
2 changed files with 10 additions and 5 deletions

View file

@ -9,7 +9,7 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDIKA_PLATFORM', 'Friendica'); define ( 'FRIENDIKA_PLATFORM', 'Friendica');
define ( 'FRIENDIKA_VERSION', '2.3.1154' ); define ( 'FRIENDIKA_VERSION', '2.3.1155' );
define ( 'DFRN_PROTOCOL_VERSION', '2.22' ); define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
define ( 'DB_UPDATE_VERSION', 1102 ); define ( 'DB_UPDATE_VERSION', 1102 );

View file

@ -108,13 +108,14 @@ function poller_run($argv, $argc){
$contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` $contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != ''
AND `network` != '%s' AND NOT `network` IN ( '%s', '%s' )
$sql_extra $sql_extra
AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0
AND `user`.`account_expired` = 0 $abandon_sql ORDER BY RAND()", AND `user`.`account_expired` = 0 $abandon_sql ORDER BY RAND()",
intval(CONTACT_IS_SHARING), intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND), intval(CONTACT_IS_FRIEND),
dbesc(NETWORK_DIASPORA) dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_FACEBOOK)
); );
if(! count($contacts)) { if(! count($contacts)) {
@ -137,6 +138,9 @@ function poller_run($argv, $argc){
if($manual_id) if($manual_id)
$contact['last-update'] = '0000-00-00 00:00:00'; $contact['last-update'] = '0000-00-00 00:00:00';
if($contact['network'] === NETWORK_DFRN)
$contact['priority'] = 2;
if($contact['priority'] || $contact['subhub']) { if($contact['priority'] || $contact['subhub']) {
$hub_update = true; $hub_update = true;
@ -218,7 +222,7 @@ function poller_run($argv, $argc){
$importer = $r[0]; $importer = $r[0];
logger("poller: poll: IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}"); logger("poller: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}");
$last_update = (($contact['last-update'] === '0000-00-00 00:00:00') $last_update = (($contact['last-update'] === '0000-00-00 00:00:00')
? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME) ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME)
@ -539,9 +543,10 @@ function poller_run($argv, $argc){
); );
} }
if(count($r)) { if(count($r)) {
if(! $r[0]['total']) if(! $r[0]['total']) {
poco_load($contact['id'],$importer_uid,$contact['poco']); poco_load($contact['id'],$importer_uid,$contact['poco']);
} }
}
// loop - next contact // loop - next contact
} }