[#876] Fix Market Cap blank box during price loading#896
Conversation
…holder - Switch price sources from sequential fallback to Promise.any() for parallel fetching - Add structured logging with per-source timing for diagnostics - Add DB fallback (trade_history.reserve_usd_rate) to survive serverless cold starts - Show "—" placeholder in MarketCapBox while PLOT/USD price is loading Fixes #876 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The loading placeholder fix in MarketCapBox is correct, but the new server-side price fetch path still has a blocker. As written, the DB fallback is not guaranteed to run during the exact cold-start / slow-source scenario this PR is trying to fix.
Findings
- [high]
Promise.any()can hang forever becausefetchFromMintClub()has no timeout, sofetchPlotUsdPrice()never reaches the DB fallback when Mint Club stalls and the HTTP sources reject.- File:
lib/usd-price.ts:60 - Suggestion: wrap the Mint Club SDK path in the same bounded timeout policy as the HTTP fetches, or race each source against a timeout before passing them into
Promise.any().
- File:
- [medium] The issue asks for logs that identify why each source failed, but the new catch blocks only emit
result=misswith elapsed time and discard the actual failure reason/status.- File:
lib/usd-price.ts:94 - Suggestion: log timeout vs HTTP status vs missing data so production logs can distinguish dead sources from transient failures.
- File:
Decision
Requesting changes because the main reliability fix is incomplete: if Mint Club hangs, users can still get stuck without a price and without the advertised DB fallback.
- Wrap Mint Club SDK call in Promise.race with 3s timeout to prevent Promise.any() from hanging when other sources reject first - Log failure reason (timeout, http_4xx, no_price_data) for all sources Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The rework fixes the blocker from my previous review. fetchFromMintClub() is now bounded by a 3s timeout, so Promise.any() can fail fast and reach the DB fallback, and the source-level logging now captures concrete failure reasons.
Findings
- No blocking findings in the updated patch.
Decision
Approving from a code-review standpoint. The timeout and logging gaps I raised are addressed in lib/usd-price.ts, and the MarketCapBox placeholder change remains correct.
Summary
Promise.any()parallel fetch — uses whichever source responds firsttrade_history.reserve_usd_rate) so cached price survives serverless cold startselapsed=Xms) for diagnosing which sources work/failFiles Changed
lib/usd-price.ts— parallel fetch, DB fallback, structured loggingsrc/components/MarketCapBox.tsx— loading state placeholderpackage.json— patch bump 0.1.24 → 0.1.25Test plan
[USD Price] source=X result=hit/miss elapsed=XmsentriesFixes #876
🤖 Generated with Claude Code