mirror of
https://github.com/kvazar-network/crawler.git
synced 2025-09-12 23:11:50 +00:00
update crawl loop conditions
This commit is contained in:
parent
5aaff00157
commit
ae39cf2a6e
@ -143,14 +143,27 @@ if (isset($argv[1]))
|
||||
}
|
||||
}
|
||||
|
||||
// Init crawl delay from argument or use default value
|
||||
$delay = empty($argv[0]) ? 60 : (int) $argv[0];
|
||||
|
||||
// Begin crawler
|
||||
while ($blocks = $kevacoin->getBlockCount())
|
||||
while (true)
|
||||
{
|
||||
// Indicate new queue begin
|
||||
// Get total blocks to crawl
|
||||
if (!$blocks = $kevacoin->getBlockCount())
|
||||
{
|
||||
// Dump errors
|
||||
if ($error = $kevacoin->getError()) {
|
||||
var_dump(
|
||||
$error
|
||||
);
|
||||
}
|
||||
|
||||
echo sprintf(
|
||||
"Found %d new blocks, begin crawl queue...\r",
|
||||
"Blocks not found!\r",
|
||||
$delay
|
||||
);
|
||||
}
|
||||
|
||||
// Begin block index
|
||||
for ($block = $state + 1; $block <= $blocks; $block++)
|
||||
@ -403,20 +416,8 @@ while ($blocks = $kevacoin->getBlockCount())
|
||||
}
|
||||
|
||||
// Dump results
|
||||
echo "Crawl operation completed!\r";
|
||||
|
||||
// Dump errors
|
||||
if ($error = $kevacoin->getError()) {
|
||||
var_dump(
|
||||
$error
|
||||
);
|
||||
}
|
||||
|
||||
// Apply delay argument, or use default value
|
||||
$delay = empty($argv[0]) ? 60 : (int) $argv[0];
|
||||
|
||||
echo sprintf(
|
||||
"Await %d seconds for new blocks...\r",
|
||||
"Crawl queue completed, await %d seconds for new blocks...\r",
|
||||
$delay
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user