limit updates from new dir servers to avoid exhausting memory.

This commit is contained in:
friendica 2014-06-29 18:18:29 -07:00
parent cc22c1da50
commit 33034bc9b6
2 changed files with 7 additions and 2 deletions

View File

@ -98,7 +98,12 @@ function sync_directories($dirmode) {
foreach($r as $rr) { foreach($r as $rr) {
if(! $rr['site_directory']) if(! $rr['site_directory'])
continue; continue;
$x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($rr['site_sync']));
// for brand new directory servers, only load the last couple of days. Everything before that will be repeats.
$syncdate = (($rr['site_sync'] === '0000-00-00 00:00:00') ? datetime_convert('UTC','UTC','now - 2 days') : $rr['site_sync']);
$x = z_fetch_url($rr['site_directory'] . '?f=&sync=' . urlencode($syncdate));
if(! $x['success']) if(! $x['success'])
continue; continue;
$j = json_decode($x['body'],true); $j = json_decode($x['body'],true);

View File

@ -176,7 +176,7 @@ function dirsearch_content(&$a) {
if($sync) { if($sync) {
$spkt = array('transactions' => array()); $spkt = array('transactions' => array());
$r = q("select * from updates where ud_date >= '%s' and ud_guid != '' group by ud_addr order by ud_date desc", $r = q("select * from updates where ud_date >= '%s' and ud_guid != '' order by ud_date desc",
dbesc($sync) dbesc($sync)
); );
if($r) { if($r) {