-
Notifications
You must be signed in to change notification settings - Fork 6
5491 - Admin links job on separate Heroku dyno - Add worker trigger #5618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5491-admin-links-job-on-separate-heroku-dyno
Are you sure you want to change the base?
5491 - Admin links job on separate Heroku dyno - Add worker trigger #5618
Conversation
| if (ProcessEnv.nodeEnv === NodeEnv.development) { | ||
| void import('./worker/tasks/verifyLinks/triggerVerifyLinksWorker') | ||
| .then(({ triggerVerifyLinksWorker }) => triggerVerifyLinksWorker()) | ||
| .catch((error) => { | ||
| Logger.error(`[verifyLinks] failed to start local worker: ${JSON.stringify(error)}`) | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting the verify-links worker automatically so local dev env doesn’t get stuck in a stale state: the server restarts, the worker dies, but Redis still says a worker is “active”. When that happens, new verify requests won’t spin up a worker and the queue just sits there until you manually restart the worker or clear Redis.
We might need something similar for prod, we could use a watchdog mechanism that checks in an interval if there are queued jobs but no dyno worker. Though could be good to test first as it is to see if that's necessary at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this in server start ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In dev we don’t have the same Heroku lifecycle (enqueue job → start dedicated dyno → dyno consumes queue), we run the worker in the same main process. So I'm starting it here so it cleans up any stale jobs that might happen because of server restarts during development.
Should we add a separate start.dev.ts maybe? what do you think?
| @@ -0,0 +1,25 @@ | |||
| import { LinkToVisit } from 'meta/cycleData/links/link' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this file from src/server/controller/cycleData/links/visitCycleLinks/utils/mergeLinks.ts. No logic changes.
TODO: