Skip to content

[Backend] scoreDecayJob is never scheduled or invoked, so inactivity score decay never runs in production #1199

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

src/cron/scoreDecayJob.ts:33 exports runScoreDecayJob as default, but a repo-wide grep shows it is referenced only by its own test. src/index.ts wires every other scheduler (startIndexer, startDefaultCheckerScheduler, startWebhookRetryScheduler, startScoreReconciliationScheduler, startNotificationCleanupScheduler, startLoanDueCheckCron at lines 59-74) but never imports or calls runScoreDecayJob. The decay job has no cron.schedule/setInterval wrapper at all, so it executes nowhere. This is distinct from the borrowers-table bug: even with that table fixed, decay still never runs because nothing calls the job.

Acceptance criteria

  • Wire score decay on a recurring schedule (e.g., daily cron) in index.ts startup, mirroring the other schedulers
  • Add a matching stop on SIGTERM/SIGINT in the index.ts shutdown path
  • Guard against overlapping runs and skip in NODE_ENV=test like the other schedulers
  • Record jobMetricsService success/failure (the job already calls it) so a missing run is visible in /metrics

Files to touch

  • backend/src/cron/scoreDecayJob.ts
  • backend/src/index.ts

Out of scope

  • Fixing the non-existent borrowers table
  • Changing decay formula

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendIssues related to backend developmentbugSomething isn't workingcriticalHigh-impact / hard issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions