diff --git a/app/Services/ComicVineService.php b/app/Services/ComicVineService.php index fec449a..92b4b13 100644 --- a/app/Services/ComicVineService.php +++ b/app/Services/ComicVineService.php @@ -118,6 +118,8 @@ public function fetchVolumeIssues(string $volumeId): array $allIssues = []; $offset = 0; $limit = 100; + $maxPages = 10; // Safety cap to avoid exceeding execution time limits + $page = 0; try { do { @@ -149,12 +151,13 @@ public function fetchVolumeIssues(string $volumeId): array } $offset += $limit; + $page++; // Respect rate limits if we need more pages if ($offset < $totalResults && ! empty($results)) { usleep(400000); } - } while ($offset < $totalResults && ! empty($results)); + } while ($offset < $totalResults && ! empty($results) && $page < $maxPages); } catch (\Exception) { // Return whatever we collected so far }