feat(HNT-2896): start the crawl-worker by role - #34
Draft
mmiermans wants to merge 1 commit into
Draft
Conversation
mmiermans
force-pushed
the
claude/hnt-2086-zyte-rate-limit
branch
from
July 6, 2026 17:09
8de019d to
e5140b5
Compare
mmiermans
force-pushed
the
claude/hnt-2086-worker-main
branch
from
July 6, 2026 17:09
b5d0ef3 to
f37548c
Compare
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.
Goal
HNT-2896
Add the crawl-worker entry point, which initializes the shared API clients and starts the consumer matching this pod's
WORKER_ROLEso one image runs as either the article or discovery worker, and drains in-flight work cleanly on SIGTERM. This builds on the article consumer, discovery consumer, and Zyte rate limiter slices by wiring them together into the entry point. See docs/ARCHITECTURE.md in #14 for the single-image two-worker system.Implementation decisions
WORKER_ROLEand fail fast on an unknown rolestartruns the article consumer or the discovery consumer, and throws before any client init when the role is neithercrawl-workerimage selected byWORKER_ROLE, deployed as two independently scalable Deployments. Failing fast stops a mislabeled or unset-role pod from running silently.shutdownawaits the drain, thenshutdownMetricsandshutdownSentry, thenshutdownRedis, and closes the server last withcloseAllConnectionsclose()resolves promptly.setTimeoutforce-exits at 28sinitCorpusApi, which skips the client whenCORPUS_API_JWK_JSONis unset, and the discovery role never initializes it