Skip to content

Commit

Permalink
Retry rendering markdown when hitting rate limit / abuse limit
Browse files Browse the repository at this point in the history
  • Loading branch information
clue committed Jun 4, 2024
1 parent 0e29f8c commit 04933e5
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions config/berti.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,23 @@
return $cacheItem->get();
}

$html = $renderer(
$content,
$document,
$documentCollection,
$assetCollection
);
try {
$html = $renderer(
$content,
$document,
$documentCollection,
$assetCollection
);
} catch (\Exception $e) {
echo 'Temporary error, will retry in 60s: ' . $e->getMessage() . PHP_EOL;
sleep(60);
$html = $renderer(
$content,
$document,
$documentCollection,
$assetCollection
);
}

$cacheItem->set($html);
$cache->save($cacheItem);
Expand Down

0 comments on commit 04933e5

Please sign in to comment.