From 2d0e66070c03501970c21a15ccda9327f3038c4f Mon Sep 17 00:00:00 2001 From: dotMavriQ Date: Sat, 14 Mar 2026 12:09:32 +0000 Subject: [PATCH] Add safety cap to ComicVine issue pagination Limits volume issue fetching to 10 pages (1000 issues) to prevent timeouts on very large series. --- app/Services/ComicVineService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 }