Lower the rate limit

This commit is contained in:
DariusIII
2025-12-05 13:50:09 +01:00
parent 93caf06dcf
commit 2e2fcc6c64
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -18,9 +18,9 @@ class PopulateAniList
private const API_URL = 'https://graphql.anilist.co';
/**
* Rate limit: 90 requests per minute
* Rate limit: 20 requests per minute (conservative limit to avoid hitting AniList's 90/min limit)
*/
private const RATE_LIMIT_PER_MINUTE = 90;
private const RATE_LIMIT_PER_MINUTE = 20;
/**
* Whether to echo message output.
+4 -4
View File
@@ -12,10 +12,10 @@ use Illuminate\Support\Facades\DB;
class RefreshAnimeData extends Command
{
/**
* Conservative rate limit: 35 requests per minute (to stay well below AniList's 90/min limit).
* Conservative rate limit: 20 requests per minute (to stay well below AniList's 90/min limit).
* This allows for multiple API calls per release (search + getById).
*/
private const RATE_LIMIT_PER_MINUTE = 35;
private const RATE_LIMIT_PER_MINUTE = 20;
/**
* Track API request timestamps for rate limiting.
@@ -387,8 +387,8 @@ class RefreshAnimeData extends Command
}
}
// Calculate minimum delay between requests (to maintain 35/min rate)
// 60 seconds / 35 requests = ~1.71 seconds per request
// Calculate minimum delay between requests (to maintain 20/min rate)
// 60 seconds / 20 requests = 3 seconds per request
$minDelay = 60.0 / self::RATE_LIMIT_PER_MINUTE;
// If we have recent requests, ensure we wait at least the minimum delay