Run the scheduled jobs in the web process and drop Celery #148
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
CrowderSoup/vTodo!148
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claude/retire-celery"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
vTodo task #686. Stacked on #147 (both change
uv.lock). Merge #147 first, and this diff then shrinks to its own commit.Nothing in vTodo queues Celery work. The
workercontainer, which ran Celery with embedded beat, only existed for two 10-minute jobs. Both now run on a daemon thread in the web process.What changed
config/periodic.py: a small scheduler.config/asgi.pystarts it whenRUN_PERIODIC_JOBSis on, and the web role inconfig/deploy.ymlsets that. The first round runs 60 s after boot so it stays clear of the health check, then each job runs everysettings.PERIODIC_JOBSinterval (600 s). Each run:op=task, named for the job) and is tagged with the job's name in Pyroscope asendpoint, as the Celery tasks were.HEARTBEAT_GCAL_SYNC_URL,HEARTBEAT_VUPLOAD_PURGE_URL) when it finishes. A failure is logged to GlitchTip, and the missing ping makes the monitor alert.periodic job … finished in Ns, which shows inkamal app logs.python manage.py runjobs [name]runs the jobs once by hand, without the lock. It exits non-zero if a job fails.workerrole,config/celery.py,celery, and Sentry'sceleryextra. The task functions are now plain functions..forgejo/workflows/deploy.ymlhas a new "Retire the old worker role" step thatdocker rm -fs the old worker container. Kamal leaves a removed role's container running, and that container would keep running the jobs. This follows the old mcp-role step and does nothing once the container is gone.CELERY_BROKER_URLname so the existing secret keeps working. Renaming it would need a secret change, so I left that out.Checked locally
pytest: 976 passed (12 new intests/test_periodic.py).makemigrations --checkreports no changes.RUN_PERIODIC_JOBS=True. The log showedperiodic jobs started: …at boot and both jobs finishing at the 60 s mark./up/returned 200, andrunjobs purgeworked in the container. The image has no celery.After deploy
docker ps --filter label=role=workeron the droplet should return nothing.🤖 Generated with Claude Code