fix(api): register logger and webhook background tasks in CELERY_IMPORTS (Solves Issue #9357)#9360
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTwo Celery task modules, plane.bgtasks.logger_task and plane.bgtasks.webhook_task, were added to CELERY_IMPORTS in the settings module. A new unit test file was added to verify these modules are listed and that corresponding tasks register in Celery's current_app.tasks. ChangesCelery task import fix
Estimated code review effort: 1 (Trivial) | ~3 minutes Related issues: Suggested labels: bug, celery, backend Suggested reviewers: none identified from provided context Poem: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Fixes a production and self-hosted issue where the Celery worker rejects and discards all API activity log tasks (
plane.bgtasks.logger_task.process_logs) enqueued byAPITokenLogMiddleware, returningReceived unregistered task/KeyError.Root cause: The
plane.bgtasks.logger_taskandplane.bgtasks.webhook_taskmodules were not loaded by Celery at startup, preventing their tasks from being registered on the Celery application.Fix:
CELERY_IMPORTStuple inapps/api/plane/settings/common.py.apps/api/plane/tests/unit/settings/test_celery_imports.pyto check that both modules are declared in settings and successfully registered in the Celery registry.Type of Change
Screenshots and Media (if applicable)
N/A (Backend task registration fix)
Test Scenarios
process_logstasks does not result in unregistered task errors.References
Fixes #9357
Summary by CodeRabbit