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
if (isset($argv[1]))
{
@ -140,12 +143,18 @@ if (isset($argv[1]))
);
break;
default:
// Is valid crawl delay?
$seconds = (int) $argv[1];
if ($seconds > 1) {
$delay = $seconds;
}
}
}
// Init crawl delay from argument or use default value
$delay = empty($argv[0]) ? 60 : (int) $argv[0];
// Begin crawler
while (true)
{