Implement caching for user admission check#498
Conversation
|
Hi! @cameri While working on my PR fixes, I noticed the project has moved to Biome formatting. When I ran Could you please confirm the expected workflow here?
I just want to align with the repository’s preferred formatting approach. |
|
Hi @Mohit-Davar — only include your functional changes, not the mass formatting reformats. The Biome config in this repo is set to report warnings, not errors, so running |
|
@Mohit-Davar let me know if that helps. I'm happy to merge with format fixes too. |
Thanks, that helps, I appreciate the clarification! I understand to keep formatting limited to the files or lines I modify instead of running a full repo format. I’ll follow that workflow in future PRs. |
Description
This PR implements the
TODO: use cacheinEventMessageHandlerby introducing a Redis-based caching layer for user admission status.Key Implementation Details
State-Aware Caching
getKeyto differentiate:1→ Admitted users0→ Blocked / insufficient balancenull→ Cache missTTL Strategy
Atomicity & Resilience
cacheSethelperTesting
event-message-handler.spec.tswith mock cache behaviorRelated Issue
Resolves the caching TODO in:
src/handlers/event-message-handler.ts#447
Motivation and Context
On high-traffic relays, performing database checks for every event introduces significant overhead.
This change:
How Has This Been Tested?
test/unit/handlers/event-message-handler.spec.tsScreenshots
N/A
Types of Changes
Checklist