trove/app/Services/PolitenessService.php
myrmidex cda1414cd8
Some checks failed
CI / ci (push) Failing after 3h0m1s
CI / ci (pull_request) Has been cancelled
9 - Add robots.txt handling with cache and politeness integration
2026-04-27 23:53:52 +02:00

19 lines
473 B
PHP

<?php
declare(strict_types=1);
namespace App\Services;
class PolitenessService
{
public function minDelayFor(string $domain): int
{
/** @var RobotsService $robotsService */
$robotsService = resolve(RobotsService::class);
$crawlDelay = $robotsService->crawlDelayFor($domain, config('crawler.user_agent'));
$configValue = config('crawler.min_domain_delay_seconds', 10);
return max($crawlDelay ?? 0, $configValue);
}
}