Retry DataForSEO Google AI Overview requests on transient server errors#472
Merged
Conversation
The AI Overview path threw on the first task-level "Internal SE Server Error" from DataForSEO's async overview load, which read as 0% on the status page even though the same request succeeds on retry. Wrap the organic SERP call in a 3-attempt backoff, mirroring the BrightData AI Overview runner.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
/statuspage shows 0% for Google AI Overview on DataForSEO. That cell is a 7-day pass rate, so 0% means thegoogle-ai-overview:dataforseo:onlinetarget has failed on every scheduled run since it was added in #469 — each one throwing:Root cause
Not a parsing bug — the error is thrown at the task-status check in
runGoogleAiOverview, before any extraction runs. DataForSEO's organic SERP task returns a non-20000status when its on-demandload_async_ai_overviewstep fails on their side.That failure is transient: running the target manually against the same account passed 10/10 times (7 solo + 3 under the same 5-way parallel DataForSEO load the scheduled job uses). The AI Overview path had no retry, so a single blip hard-fails the run and records a fail. Its sibling from the same PR — BrightData's
runGoogleAiOverview— already wraps its call in a 3-attempt backoff, which is why BrightData's AI Overview reads healthy while DataForSEO's reads 0%.Fix
Wrap the organic SERP call in the same 3-attempt linear backoff (1.5s, 3s) the BrightData runner uses. A transient
Internal SE Server Erroris retried instead of failing the run; a genuinely failing request still throws the sameDataForSEO API Error: …after 3 attempts. Retries only fire on a failed attempt (at most 4×/day per target).Testing
packages/libunit tests pass, including two new cases — retry-then-succeed and throw-after-3-failures — using fake timers.tscclean for@workspace/lib.