Make the daily scraper survive refused connections from govjobs.publi… - #13
Merged
Merged
Conversation
…c.lu Recent runs died with an uncaught "[Errno 111] Connection refused" in the middle of the listing crawl, so nothing was saved, committed or notified. The site refuses TCP connections when a runner IP opens too many of them, and every bare requests.get() opened a new TCP+TLS connection. job_scraper.py: - one keep-alive requests.Session for all requests (the live test ran 41 requests over a single connection), timeouts, urllib3 retries with backoff for refused connections and 429/5xx (Retry-After capped at 60s) - crawl the listing first, then the missing detail pages; on errors stop and save what was collected (::warning::), exit 1 only if nothing was scraped; missing details are fetched on the next run - circuit breaker after 3 consecutive failed detail pages, max 100 detail fetches and a 20 minute time budget per run - check listing status codes, dedupe links, max page guard, compare the collected count with the count shown on the site telegram.py: - HTML parse mode, split messages between job blocks instead of every 4000 characters (cut links made Telegram reject the chunk) - timeout, retries, exit 1 when a message can't be sent Workflow: - checkout@v7 / setup-python@v7 (Node 24), Python 3.14, pip cache, install from requirements.txt (drop unused firebase-admin) - cron at 05:17 and 15:47 UTC instead of 00:00, concurrency group, timeout-minutes, contents: write, push with rebase retry - notify and commit only on main, notify before committing so a failed notification is resent by the next run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
…c.lu
Recent runs died with an uncaught "[Errno 111] Connection refused" in the middle of the listing crawl, so nothing was saved, committed or notified. The site refuses TCP connections when a runner IP opens too many of them, and every bare requests.get() opened a new TCP+TLS connection.
job_scraper.py:
telegram.py:
Workflow: