-
-
Notifications
You must be signed in to change notification settings - Fork 202
Fix: DevRank Spider Premature Exit (Split Core/Search Rate Limits) #9088
Copy link
Copy link
Closed
Labels
Description
Problem
The DevRank.services.Spider incorrectly triggers a "Graceful Exit" (stopping all operations) when the GitHub API Search Rate Limit (30 req/min) is reached, even if the Core Rate Limit (5000 req/hr) is still healthy.
This happens because GitHub.mjs currently tracks a single rateLimit object, which gets overwritten by the headers of the last request.
- Spider runs a search query ->
rateLimitupdated to ~29/30. - Spider tries to process repositories (fetching contributors via Core API).
- Spider sees
rateLimit.remainingis 29 (from Search) and incorrectly thinks it's below the safety threshold (50), triggering a shutdown.
Goal
Decouple rate limit tracking to respect GitHub's x-ratelimit-resource header.
Proposed Changes
-
Refactor
GitHub.mjs:- Change
rateLimitconfig to store multiple buckets:rateLimit: { core: { remaining: 5000, reset: null, limit: 5000 }, search: { remaining: 30, reset: null, limit: 30 }, graphql: { remaining: 5000, reset: null, limit: 5000 }, integration_manifest: { remaining: 5000, reset: null, limit: 5000 } }
- Update
#updateRateLimitto readx-ratelimit-resourceand update the corresponding bucket.
- Change
-
Update
Spider.mjs:- Use
GitHub.rateLimit.searchforrunSearch. - Use
GitHub.rateLimit.coreforfetchContributors/processRepositories.
- Use
-
Update
Updater.mjs:- Ensure it uses the correct bucket (likely
graphqlorcore).
- Ensure it uses the correct bucket (likely
Acceptance Criteria
- Spider continues processing repositories (Core API) even if Search API limit is exhausted.
- Spider pauses only searching when Search limit is low.
- Logs clearly distinguish between Core and Search limits.
Reactions are currently unavailable