Skip to content

Add scheduled cron job for balance monitoring#143

Merged
TaprootFreak merged 2 commits intodevelopfrom
feature/scheduled-balance-monitoring
Feb 14, 2026
Merged

Add scheduled cron job for balance monitoring#143
TaprootFreak merged 2 commits intodevelopfrom
feature/scheduled-balance-monitoring

Conversation

@TaprootFreak
Copy link
Contributor

Summary

  • Add @Cron(EVERY_5_MINUTES) to MonitoringService for scheduled balance monitoring
  • Fetches wallet balances directly from DB, independent of webhook triggers
  • Ensures Boltz swaps, channel opens/closes, and manual BTC transactions update monitoring_balance data
  • Existing event-driven path via LightningWalletService remains unchanged as real-time optimization

Test plan

  • yarn lint passes
  • yarn build passes
  • Verify cron triggers every 5 minutes in dev/staging logs
  • Confirm monitoring_balance updates after manual BTC transaction (without webhook)
  • Verify no duplicate DB writes (checksum logic in saveIfBalanceDiff)

MonitoringService.processBalanceMonitoring() was only triggered by
LNbits/Alchemy webhooks via LightningWalletService. This meant Boltz
swaps, channel opens/closes, and manual Bitcoin transactions would not
update monitoring_balance data.

Add a @Cron(EVERY_5_MINUTES) method that independently fetches wallet
balances from the database and processes them, matching the pattern
used by MonitoringEvmService. The existing event-driven path remains
unchanged as a real-time optimization.
@TaprootFreak TaprootFreak marked this pull request as ready for review February 14, 2026 18:51
Call processScheduledBalanceMonitoring() in onModuleInit() so balances
are checked immediately after deployment, matching MonitoringEvmService
pattern.
@TaprootFreak TaprootFreak requested a review from Danswar February 14, 2026 18:55
@TaprootFreak TaprootFreak merged commit 6c6ca31 into develop Feb 14, 2026
1 check passed
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