mirror of
https://github.com/kvazar-network/crawler.git
synced 2025-09-07 04:22:03 +00:00
fix update loop, remove debug messages
This commit is contained in:
parent
116cce4fb7
commit
a4984e892d
@ -149,7 +149,7 @@ if (isset($argv[1]))
|
||||
// Is valid crawl delay?
|
||||
$seconds = (int) $argv[1];
|
||||
|
||||
if ($seconds > 1) {
|
||||
if ($seconds >= 1) {
|
||||
$delay = $seconds;
|
||||
}
|
||||
}
|
||||
@ -158,27 +158,13 @@ if (isset($argv[1]))
|
||||
// Begin crawler
|
||||
while (true)
|
||||
{
|
||||
// Get total blocks to crawl
|
||||
if (!$blocks = $kevacoin->getBlockCount())
|
||||
if ($blocks = $kevacoin->getBlockCount())
|
||||
{
|
||||
// Dump errors
|
||||
if ($error = $kevacoin->getError()) {
|
||||
var_dump(
|
||||
$error
|
||||
);
|
||||
}
|
||||
|
||||
echo sprintf(
|
||||
"Blocks not found!\r",
|
||||
$delay
|
||||
);
|
||||
}
|
||||
|
||||
// Begin block index
|
||||
for ($block = $state + 1; $block <= $blocks; $block++)
|
||||
{
|
||||
// Debug progress
|
||||
echo sprintf(
|
||||
printf(
|
||||
"%d/%d\r",
|
||||
$block,
|
||||
$blocks
|
||||
@ -423,12 +409,17 @@ while (true)
|
||||
$block
|
||||
);
|
||||
}
|
||||
|
||||
// Dump results
|
||||
echo sprintf(
|
||||
"Crawl queue completed, await %d seconds for new blocks...\r",
|
||||
$delay
|
||||
}
|
||||
else
|
||||
{
|
||||
// Dump errors
|
||||
if ($error = $kevacoin->getError())
|
||||
{
|
||||
var_dump(
|
||||
$error
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sleep($delay);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user