mirror of
https://github.com/YGGverse/Yo.git
synced 2025-01-30 08:24:16 +00:00
make custom resolver optionally required to continue the crawl #15
This commit is contained in:
parent
1b8bcb084a
commit
bc9fc470e6
@ -138,6 +138,7 @@
|
||||
"resolver":
|
||||
{
|
||||
"enabled":true,
|
||||
"require":false,
|
||||
"providers":
|
||||
[
|
||||
"1.1.1.1",
|
||||
|
@ -295,25 +295,49 @@ foreach($index->search('')
|
||||
|
||||
else
|
||||
{
|
||||
// Log event
|
||||
if ($config->cli->document->crawl->debug->level->warning)
|
||||
// Custom resolver required to continue
|
||||
if ($config->cli->document->crawl->resolver->require)
|
||||
{
|
||||
echo sprintf(
|
||||
_('[%s] [warning] could not resolve "%s" (attempt: %d, response: %s), wait for reconnection...') . PHP_EOL,
|
||||
date('c'),
|
||||
$base->getHost(),
|
||||
$attempt++,
|
||||
print_r(
|
||||
$errors,
|
||||
true
|
||||
)
|
||||
// Log event
|
||||
if ($config->cli->document->crawl->debug->level->warning)
|
||||
{
|
||||
echo sprintf(
|
||||
_('[%s] [warning] could not resolve "%s" (attempt: %d, response: %s), wait for reconnection...') . PHP_EOL,
|
||||
date('c'),
|
||||
$base->getHost(),
|
||||
$attempt++,
|
||||
print_r(
|
||||
$errors,
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Next connection delay
|
||||
sleep(
|
||||
$config->cli->document->crawl->resolver->connection->delay
|
||||
);
|
||||
}
|
||||
|
||||
// Next connection delay
|
||||
sleep(
|
||||
$config->cli->document->crawl->resolver->connection->delay
|
||||
);
|
||||
// Use system-wide resolver, break the pending loop
|
||||
else
|
||||
{
|
||||
if ($config->cli->document->crawl->debug->level->warning)
|
||||
{
|
||||
echo sprintf(
|
||||
_('[%s] [warning] could not resolve "%s" (attempt: %d, response: %s), use system-wide...') . PHP_EOL,
|
||||
date('c'),
|
||||
$base->getHost(),
|
||||
$attempt++,
|
||||
print_r(
|
||||
$errors,
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} while (!$resolved);
|
||||
|
Loading…
x
Reference in New Issue
Block a user