fix(docs): fall back to direct URL when page verification is rate-lim…#41
Open
RajPorus19 wants to merge 1 commit into
Open
fix(docs): fall back to direct URL when page verification is rate-lim…#41RajPorus19 wants to merge 1 commit into
RajPorus19 wants to merge 1 commit into
Conversation
Author
|
There was an error, i'm turning this into draft until I fix it. |
e928622 to
68d014b
Compare
… rate-limited When resolve_doc_url() returns nil (rate-limited, network error, or unreachable from docs.godotengine.org), instead of giving up with a "Could not find Godot docs" error, construct the page URL from the class name and proceed directly to fetch_markdown() from the GitHub RST source. This mirrors the approach used in real-world setups where docs.godotengine.org aggressively rate-limits shared IPs but raw.githubusercontent.com remains reachable. The fallback path: 1. Construct page_url from build_base_url() + class_slug() 2. For browser renderer: open the URL directly 3. For buffer/float: call open_from_rst() which fetches RST from GitHub 4. If RST also fails: the existing fallback_renderer logic handles it
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.
Summary
Fix
:GodotDocs(and related commands) failing completely whendocs.godotengine.orgrate-limits or is unreachable — even though the RST documentation source on GitHub is perfectly reachable.Details
Problem
M.open()inlua/godotdev/docs.luacallsfetch.resolve_doc_url()which always fetches HTML fromdocs.godotengine.orgto verify the page exists before attempting the RST source fetch. When that host returns HTTP 429 (rate limit):fetch_index()is called as fallback — but it also hitsdocs.godotengine.orgcallback(nil, nil)→M.open()shows "Could not find Godot docs" and abortsThe RST source fetch (
fetch_markdown()→raw.githubusercontent.com/godotengine/godot-docs) is never reached, even though it's on a completely different domain and works fine.Fix
In
M.open()(lua/godotdev/docs.lua): whenresolve_doc_url()returnsnil(rate-limited / network error), instead of showing an error and aborting, bypass the HTML verification entirely and proceed directly to the RST source:common.build_base_url()+common.class_slug()open_from_rst()which fetches RST from GitHub viafetch_markdown()fallback_rendererlogic handles the fallback to browserThis mirrors the proven approach used in real-world setups where
docs.godotengine.orgaggressively rate-limits shared IPs but✅ Checklist
📷 Screenshots (if applicable)
🧩 Related Issues
#40 40 Bug: :GodotDocs fails completely when docs.godotengine.org rate-limits (HTTP 429)