Skip to content

[Backend Feature] : add Production Reminder Scheduler Never Starts Due to Mock Scheduler Initialization#145

Open
hrshjswniii wants to merge 11 commits into
vanshaggarwal27:mainfrom
hrshjswniii:feature/Production-Reminder-Scheduler
Open

[Backend Feature] : add Production Reminder Scheduler Never Starts Due to Mock Scheduler Initialization#145
hrshjswniii wants to merge 11 commits into
vanshaggarwal27:mainfrom
hrshjswniii:feature/Production-Reminder-Scheduler

Conversation

@hrshjswniii

Copy link
Copy Markdown
Contributor

Problem


The backend startup process was initializing a mock scheduler rather than the production scheduler responsible for monitoring user progress and triggering reminder workflows. As a result, automated reminders and progress checks were never executed in production environments.

Additionally, notification-related services existed in multiple locations (alerts/ and services/) with overlapping responsibilities, creating code duplication, maintenance overhead, and uncertainty about which implementation was actually active.

The application also relied on FastAPI's deprecated startup event mechanism, which generated framework deprecation warnings and was no longer aligned with current FastAPI best practices.



Solution


This PR promotes the production-ready scheduler to become the application's primary scheduling mechanism and consolidates all active notification services into a single, maintainable architecture.

Key improvements include:

  • Replacing the mock scheduler with the production scheduler used for real user progress monitoring and reminder execution.
  • Consolidating Twilio, ElevenLabs, scheduler, and progress-checking functionality into a unified services/ layer.
  • Removing duplicate, inactive, and legacy implementations to reduce technical debt.
  • Modernizing FastAPI startup and shutdown handling by migrating from deprecated startup hooks to the lifespan pattern.
  • Updating test and tooling configurations to align with the new architecture.


Files Affected


Added

  • backend/services/scheduler.py
  • backend/services/progress_checker.py
  • backend/services/twilio_service.py
  • backend/services/elevenlabs_service.py

Modified

  • backend/main.py
  • backend/ruff.toml
  • backend/tests/conftest.py

Removed

  • backend/alerts/ (entire directory)
  • backend/services/reminder_scheduler.py
  • backend/services/call_service.py
  • backend/services/voice_service.py
  • backend/utils/progress_checker.py


User Stories


  • As a platform administrator, I want reminder jobs to run automatically against real user data so that users receive timely notifications.
  • As a developer, I want a single source of truth for notification and scheduler services so that the codebase is easier to maintain and extend.
  • As a contributor, I want startup and shutdown logic to follow modern FastAPI standards so that the application remains compatible with future framework versions.
  • As a maintainer, I want duplicate service implementations removed so that bugs and feature updates only need to be made in one place.


Acceptance Criteria


  • The production scheduler is started automatically when the backend launches.
  • User progress checks execute through the production scheduling workflow.
  • Twilio and ElevenLabs integrations use a single consolidated service implementation.
  • Legacy mock schedulers and duplicate service implementations are removed.
  • Application startup and shutdown use FastAPI lifespan handlers.
  • Existing tests pass without regressions.
  • No deprecated startup lifecycle warnings are emitted during application startup.

Contribution Interest

Hiii @vanshaggarwal27 , i've implemented the issue i was assigned
please do review and feel free to merge the PR
fixes issue #135

@vanshaggarwal27

Copy link
Copy Markdown
Owner

please resolve merge conflicts then i will merge it.

@vanshaggarwal27

Copy link
Copy Markdown
Owner

@hrshjswniii is work done ??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants