Skip to content

Review and Refactor Celery Task Implementation #1

Description

@al-chris

Context

Upon revisiting the project after some time, I've noticed the Celery task setup and usage may not be functioning as intended. The implementation was originally done while I was still learning Celery, and likely requires a careful review and refactor.

Recent review of the codebase (including the monitor_transactions task and related async helpers) suggests the following improvements and areas needing attention:

  • Ensure that Celery is properly configured and started with the correct broker and backend.
  • Confirm that async functions are being invoked and awaited correctly within Celery tasks (since Celery tasks are sync by default).
  • Audit the use of nest_asyncio—consider if it's still needed or if code can be restructured to avoid it.
  • Check for error handling and session management in async DB operations to prevent resource leaks.

Tasks

  • Review all Celery task definitions and their usage patterns
  • Ensure tasks are defined and called according to best practices
  • Verify proper error handling and task result retrieval
  • Update documentation as needed
  • Add or update automated tests for Celery task logic, mocking external services as needed
  • Address any issues with async task patterns, DB session management, or external API calls

Metadata

Metadata

Assignees

Labels

refactorMake this work right

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions