mirror of
https://github.com/kvazar-network/crawler.git
synced 2025-09-09 05:22:02 +00:00
fix delay argument
This commit is contained in:
parent
ae39cf2a6e
commit
116cce4fb7
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user