Skip to content

fix(markets): invalidate cache on update/pause/resume/cancel (#1273)#1301

Merged
Olowodarey merged 1 commit into
Arena1X:mainfrom
codewithzubair07:fix/1273-market-cache-invalidation
Jul 21, 2026
Merged

fix(markets): invalidate cache on update/pause/resume/cancel (#1273)#1301
Olowodarey merged 1 commit into
Arena1X:mainfrom
codewithzubair07:fix/1273-market-cache-invalidation

Conversation

@codewithzubair07

Copy link
Copy Markdown
Contributor

Closes #1273

Problem

update, pauseMarket, and resumeMarket in markets.service.ts skipped cache invalidation entirely. cancelMarket/resolveMarket invalidated inline with duplicated logic and no list-level activeEvents key.

Fix

  • Added centralized invalidateMarketCaches(marketId) helper (clears in-memory trending cache + trendingEvents, activeEvents, popularEventDetail(id) keys)
  • Wired into update, pauseMarket, resumeMarket, cancelMarket, resolveMarket

Tests

  • Invalidation assertions for update/pause/resume/cancel
  • "no invalidation on rejected mutation" for each
  • Stale-read coverage (mutate → cache cleared)

36/36 tests pass, tsc --noEmit clean.

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
insight-arena-4rll Ready Ready Preview, Comment Jul 21, 2026 8:38pm

@Olowodarey
Olowodarey merged commit 5c0a38c into Arena1X:main Jul 21, 2026
5 checks 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.

[Backend] — Cache Invalidation on Market State Mutations Not Covered by Tests

2 participants