fix delay argument

This commit is contained in:
kvazar-network 2025-03-31 19:06:08 +03:00
parent ae39cf2a6e
commit 116cce4fb7

View File

@ -107,6 +107,9 @@ catch (Exception $exception)
); );
} }
// Default crawl delay in seconds
$delay = 60;
// Init optional commands // Init optional commands
if (isset($argv[1])) if (isset($argv[1]))
{ {
@ -140,11 +143,17 @@ if (isset($argv[1]))
); );
break; break;
}
}
// Init crawl delay from argument or use default value default:
$delay = empty($argv[0]) ? 60 : (int) $argv[0];
// Is valid crawl delay?
$seconds = (int) $argv[1];
if ($seconds > 1) {
$delay = $seconds;
}
}
}
// Begin crawler // Begin crawler
while (true) while (true)