mirror of
https://github.com/kvazar-network/crawler.git
synced 2025-09-07 12:32:00 +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?
|
// Is valid crawl delay?
|
||||||
$seconds = (int) $argv[1];
|
$seconds = (int) $argv[1];
|
||||||
|
|
||||||
if ($seconds > 1) {
|
if ($seconds >= 1) {
|
||||||
$delay = $seconds;
|
$delay = $seconds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,27 +158,13 @@ if (isset($argv[1]))
|
|||||||
// Begin crawler
|
// Begin crawler
|
||||||
while (true)
|
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
|
// Begin block index
|
||||||
for ($block = $state + 1; $block <= $blocks; $block++)
|
for ($block = $state + 1; $block <= $blocks; $block++)
|
||||||
{
|
{
|
||||||
// Debug progress
|
// Debug progress
|
||||||
echo sprintf(
|
printf(
|
||||||
"%d/%d\r",
|
"%d/%d\r",
|
||||||
$block,
|
$block,
|
||||||
$blocks
|
$blocks
|
||||||
@ -423,12 +409,17 @@ while (true)
|
|||||||
$block
|
$block
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Dump results
|
else
|
||||||
echo sprintf(
|
{
|
||||||
"Crawl queue completed, await %d seconds for new blocks...\r",
|
// Dump errors
|
||||||
$delay
|
if ($error = $kevacoin->getError())
|
||||||
|
{
|
||||||
|
var_dump(
|
||||||
|
$error
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sleep($delay);
|
sleep($delay);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user