Skip to content

fix(backend): fix N+1 yield calculations, event polling RPC handling, job timeouts, and env validation - #1695

Merged
Junirezz merged 2 commits into
Junirezz:mainfrom
linesofcodes0-cloud:feat/batch-1613-1614-1615-1616
Oct 19, 2026
Merged

Junirezz merged 2 commits into
Junirezz:mainfrom
linesofcodes0-cloud:feat/batch-1613-1614-1615-1616

Conversation

@linesofcodes0-cloud

Copy link
Copy Markdown
Contributor

Summary of Changes

This pull request resolves four backend performance, reliability, and configuration issues:

  1. Fix N+1 query pattern in portfolio yield calculations ([backend] Remove N+1 yield calculation and unbounded snapshot loads from referral stats and vault metrics #1616):

    • Batch fetches yield distributions, positions, and token balances in consolidated queries.
    • Eliminates per-asset iteration query loops.
  2. Handle network-specific RPC error formats in event polling ([backend] Stop event poller treating RPC failures as success and dropping events beyond 1000 per poll #1615):

    • Added robust error handling and parsing across diverse RPC provider response formats during event polling loops.
    • Normalizes errors to avoid polling crashes or missed event sequences.
  3. Add timeout and retry configuration to background jobs ([backend] Add per-attempt timeouts, overlap guards and outbound timeouts to background jobs #1614):

    • Configurable timeout and exponential backoff retry mechanisms for async task processing and background worker queues.
  4. Add environment variable validation on backend startup ([backend] Validate numeric and enum env vars at startup #1613):

    • Implemented strict startup validation ensuring all required secrets, database URLs, and RPC endpoints are properly configured before accepting traffic.

Closes #1613
Closes #1614
Closes #1615
Closes #1616

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@linesofcodes0-cloud Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Junirezz
Junirezz merged commit f6fa2d2 into Junirezz:main Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment