Skip to content

feat(status): add 3-second in-memory cache to throttle DB status inquiries#385

Merged
Sadeequ merged 1 commit into
StellarFlow-Network:mainfrom
AugistineCreates:feature/status-cache
Jun 1, 2026
Merged

feat(status): add 3-second in-memory cache to throttle DB status inquiries#385
Sadeequ merged 1 commit into
StellarFlow-Network:mainfrom
AugistineCreates:feature/status-cache

Conversation

@AugistineCreates
Copy link
Copy Markdown

@AugistineCreates AugistineCreates commented Jun 1, 2026

This pr closes #359

This PR implements a lightweight caching interceptor layer directly inside the system status route to resolve this.

Technical Changes

  • Status Endpoint Interceptor (src/routes/status.ts):
    • Introduced a localized in-memory cache (statusCache) with a TTL of 3000ms.
    • When a status inquiry request is received, it checks if cached data is present and within the 3000ms window.
    • If valid, the endpoint serves the cached data immediately without executing any database/Prisma operations.
    • If expired (or not yet initialized), the endpoint performs the database query (prisma.$queryRaw and prisma.priceHistory.findFirst), updates the memory cache with the new status data and timestamp, and returns the response.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@AugistineCreates 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

@Sadeequ Sadeequ merged commit 6b6f1b5 into StellarFlow-Network:main Jun 1, 2026
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.

💸 Rate-Limiting | Throttling Node Status Inquiries

2 participants