Skip to content

fix(pricing): await currencies load in CoinGeckoService.onModuleInit#187

Merged
TaprootFreak merged 1 commit into
developfrom
fix/coingecko-await-init
May 12, 2026
Merged

fix(pricing): await currencies load in CoinGeckoService.onModuleInit#187
TaprootFreak merged 1 commit into
developfrom
fix/coingecko-await-init

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

  • CoinGeckoService.onModuleInit() started loading supported currencies with a void promise (no await)
  • If MonitoringService.processBalances() fires before that promise resolves (typical on container startup), getCurrency() crashes with Cannot read properties of undefined (reading 'find')
  • Make onModuleInit properly async so NestJS waits for the currencies load before app starts serving

Test plan

  • Deploy to dfxdev
  • No Cannot read properties of undefined (reading 'find') errors in container startup logs

The onModuleInit method used void-promise pattern, leaving
this.currencies undefined until the async call resolved. If
MonitoringService cron fired before that (which it does on
container start), getCurrency() crashed with
"Cannot read properties of undefined (reading 'find')".

Make onModuleInit properly async with try/catch to preserve
original resilience (CoinGecko outage at startup should not
crash app startup) while adding error logging.
@TaprootFreak TaprootFreak force-pushed the fix/coingecko-await-init branch from e59a9d7 to d8bc93a Compare May 12, 2026 21:07
@TaprootFreak TaprootFreak marked this pull request as ready for review May 12, 2026 21:42
@TaprootFreak TaprootFreak merged commit 4bd5cac into develop May 12, 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.

1 participant