Removed useless, redundant code filtering the list of instances at the beginning of the “crawl” function: filtering already happens before adding an instance to next round list
This commit is contained in:
parent
a677d3301b
commit
d502fde347
1 changed files with 3 additions and 31 deletions
|
@ -247,34 +247,6 @@ function crawl(&$list,$id) {
|
|||
lecho(1,'will check '.$clist.' instance(s).'.N);
|
||||
$nlist=[];
|
||||
$i=0;
|
||||
$buf=[];
|
||||
foreach ($list as $inst) {
|
||||
$i++;
|
||||
$whynot=[];
|
||||
if (in_array($inst,$ckinsts)) {
|
||||
$whynot[]='it has already been checked';
|
||||
$inckinsts=true;
|
||||
} else {
|
||||
$inckinsts=false;
|
||||
}
|
||||
if (!validhostname($inst)) $whynot[]='its hostname is not valid';
|
||||
if (ckexarr($inst)) $whynot[]='its hostname matches an exclusion regexp';
|
||||
if ($opts['excludedead'] && in_array($inst,$deadinsts)) $whynot[]='it’s dead';
|
||||
if (count($whynot)>0) {
|
||||
lecho(0,'excluding instance «'.$inst.'» ('.$i.'/'.$clist.'): '.implode(', ',$whynot).'.'.N);
|
||||
} else {
|
||||
lecho(0,'including instance «'.$inst.'» ('.$i.'/'.$clist.').'.N);
|
||||
$buf[]=$inst;
|
||||
if (!$inckinsts) $ckinsts[]=$inst;
|
||||
}
|
||||
}
|
||||
$cbuf=count($buf);
|
||||
$list=$buf;
|
||||
unset($buf);
|
||||
if ($clist-$cbuf>0)
|
||||
lecho(1,'excluded '.($clist-$cbuf).' instances; '.$cbuf.' instances remaining.'.N);
|
||||
$clist=$cbuf;
|
||||
$i=0;
|
||||
$rtini=time();
|
||||
foreach ($list as $inst) {
|
||||
$responded=false;
|
||||
|
@ -304,11 +276,11 @@ function crawl(&$list,$id) {
|
|||
break;
|
||||
} else {
|
||||
$whynot=[];
|
||||
if (in_array($peer,$ckinsts)) $whynot[]='it has already been checked or excluded';
|
||||
if (in_array($peer,$ckinsts)) $whynot[]='it has already been checked';
|
||||
if (!validhostname($peer)) $whynot[]='its hostname is not valid';
|
||||
if (ckexarr($peer)) $whynot[]='its hostname matches an exclusion regexp';
|
||||
if (in_array($peer,$list)) $whynot[]='it is already present in current list';
|
||||
if (in_array($peer,$nlist)) $whynot[]='it is already present in next round list';// this should never happen, but.
|
||||
if (in_array($peer,$nlist)) $whynot[]='it is already present in next round list';
|
||||
if ($opts['excludedead'] && in_array($peer,$deadinsts)) $whynot[]='it’s dead';
|
||||
if (count($whynot)>0) {
|
||||
lecho(0,'instance «'.$inst.'»: not adding peer «'.$peer.'» ('.$pi.'/'.$cpeers.') to next round list: '.implode(', ',$whynot).'.'.N);
|
||||
|
@ -348,7 +320,7 @@ function crawl(&$list,$id) {
|
|||
} elseif ($cres>1) {
|
||||
lecho(2,'instance «'.$inst.'» has '.$cres.' records in “Instances” table! :-('.N);
|
||||
} else {
|
||||
lecho(1,'instance «'.$inst.'» is already present in “Instances” table.'.N);//+++
|
||||
lecho(1,'instance «'.$inst.'» is already present in “Instances” table.'.N);
|
||||
}
|
||||
} else {
|
||||
lecho(1,'instance «'.$inst.'» didn’t respond :-('.N);
|
||||
|
|
Loading…
Reference in a new issue