Skip to content

Add notifications/src/services/schedulerService.ts for time-based alerts #379

Description

@Levi-Ojukwu

Description
The invoice.expiring_soon notification requires a scheduler that checks upcoming due dates periodically and triggers delivery 72 hours and 24 hours before expiry. Without a scheduler, time-based notifications cannot work.

Requirements and context

  • Query the indexer API (or directly the database) for invoices with state = Funded and dueDate within 72h or 24h
  • Deliver notifications to all subscribers for the invoice's payer, LP, and submitter
  • Track delivered reminders to avoid duplicate sends (idempotency key per invoice + threshold)
  • Schedule checks every 30 minutes
  • Write unit tests including idempotency behaviour

Suggested execution

git checkout -b feat/notifications-scheduler
  • Create notifications/src/services/schedulerService.ts using node-cron
  • Implement idempotency via a delivered_reminders database table
  • Write unit tests

Example commit message
feat(notifications): add scheduler service for time-based due-date alerts


Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions