1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-12 11:34:09 +02:00

feat: introduce RateLimitException (#4199)

This commit is contained in:
Dag
2024-08-08 02:13:04 +02:00
committed by GitHub
parent 7073bb2f46
commit 9973f731df
6 changed files with 24 additions and 7 deletions

View File

@@ -82,13 +82,14 @@ class YoutubeBridge extends BridgeAbstract
{
$cacheKey = 'youtube_rate_limit';
if ($this->cache->get($cacheKey)) {
throw new HttpException('429 Too Many Requests', 429);
throw new RateLimitException();
}
try {
$this->collectDataInternal();
} catch (HttpException $e) {
if ($e->getCode() === 429) {
$this->cache->set($cacheKey, true, 60 * 16);
throw new RateLimitException();
}
throw $e;
}