mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 03:01:34 +00:00
Lower the rate limit
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user