Fixed a flaw in “dead instances” loading queries

This commit is contained in:
pezcurrel 2023-12-31 22:57:07 +01:00
parent 417803a76d
commit 4e5973e874

View file

@ -201,12 +201,12 @@ $deadinsts=[];
if ($opts['excludedead']) {
$graceline=time()-$opts['gracetime'];
lecho(1,'loading dead instances from “Instances” and “Peers” table (gracetime: '.ght($opts['gracetime'],null,0).'; graceline: '.date('Y-m-d H:i:s',$graceline).').'.N);
$res=myq($link,'SELECT URI FROM Instances WHERE LastOkCheckTS<'.$graceline.' OR (LastOkCheckTS IS NULL AND InsertTS<'.$graceline.')');
$res=myq($link,'SELECT URI FROM Instances WHERE LastOkCheckTS<'.$graceline.' OR LastOkCheckTS IS NULL');
lecho(1,'got '.mysqli_num_rows($res).' dead instances from “Instances” table.'.N);
while ($row=mysqli_fetch_assoc($res))
if (!in_array($row['URI'],$deadinsts))
$deadinsts[]=$row['URI'];
$res=myq($link,'SELECT Hostname FROM Peers WHERE LastOkCheckTS<'.$graceline.' OR (LastOkCheckTS IS NULL AND FirstCheckTS<'.$graceline.')');
$res=myq($link,'SELECT Hostname FROM Peers WHERE LastOkCheckTS<'.$graceline.' OR LastOkCheckTS IS NULL');
lecho(1,'got '.mysqli_num_rows($res).' dead instances from “Peers” table.'.N);
while ($row=mysqli_fetch_assoc($res))
if (!in_array($row['Hostname'],$deadinsts))