Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/Services/ComicVineService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down
Loading