Repository navigation
fix(crawler): stop the crawl looping on null repository nodes - #663
Merged
Merged
Conversation
GitHub returns a null node for a repository it cannot return. Reading its name threw inside the page loop, the catch only logged it, and the cursor never moved, so the crawler re-requested the same page every few seconds. Run 37978104944 did that for an hour until it was cancelled, and run 37864259112 did it for 25 minutes before ending green with nothing crawled. Null nodes are now skipped and counted, a GraphQL response without repositories fails the run, and finding no readable repositories fails it too. GraphQL 5xx answers are retried like rate limits, every request times out after 30 seconds, and the crawl job times out after 45 minutes.
There was a problem hiding this comment.
🟢 Approval recommended
The changes directly resolve the documented loop while adding appropriate operational safeguards and regression coverage.
0 open findings
What changed in this PR
Prevents scheduled crawler hangs caused by null GitHub repository nodes and improves failure handling.
Changes:
- Skips unreadable repository nodes and advances pagination safely.
- Adds request timeouts, 5xx retries, and explicit crawl failures.
- Limits scheduled crawler execution to 45 minutes.
| File | Description |
|---|---|
crawler/src/main.js |
Hardens GraphQL crawling and request handling. |
crawler/test/main.test.js |
Tests null repository-node handling. |
.github/workflows/scheduled.yml |
Adds a crawler job timeout. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
The scheduled crawl hangs: it never gets past the first page of bcgov repositories.
Cause
node: null(with an error entry) for a repository it can't return.reposFromEdgesreadedge.node.nameon that null node and threw. The page loop's catch only logged the error and didn't advance the cursor, so it asked for the same page again, about every 5 seconds, forever.TypeError: Cannot read properties of null (reading 'name')and one GraphQL 502 over 61 minutes, then was cancelled. It never reached bulk-load.Changes
crawler/src/main.jsrepositoriesfails the run, with GitHub's errors, instead of ending quietly. The catch that retried the same page forever is removed.scheduled.yml: the crawl job getstimeout-minutes: 45, about twice the last full run, instead of the 6-hour default.Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: