OBP-API/CHANGES_SUMMARY.md
simonredfern efc1868fd4 BREAKING CHANGE: Switch active-rate-limits endpoint to hour-based format
Changed from full timestamp to hour-only format to match implementation.

OLD: /active-rate-limits/2025-12-31T13:34:46Z (YYYY-MM-DDTHH:MM:SSZ)
NEW: /active-rate-limits/2025-12-31-13 (YYYY-MM-DD-HH)

Benefits:
- API now matches actual implementation (hour-level caching)
- Eliminates timezone/minute truncation confusion
- Clearer semantics: 'active during this hour' not 'at this second'
- Direct cache key mapping improves performance
- Simpler date parsing (no timezone handling needed)

Files changed:
- APIMethods600.scala: Updated endpoint and date parsing
- RateLimitsTest.scala: Updated all test cases to new format
- Glossary.scala: Updated API documentation
- introductory_system_documentation.md: Updated user docs

This is a breaking change but necessary to align API with implementation.
Rate limits are cached and queried at hour granularity, so the API
should reflect that reality.
2025-12-30 17:35:38 +01:00

42 lines
1.5 KiB
Markdown

# Summary of Changes
## 1. Added TODO Comment in Code
**File:** `obp-api/src/main/scala/code/api/util/RateLimitingUtil.scala`
Added a TODO comment at line 154 explaining the optimization opportunity:
- Remove redundant EXISTS check since GET returns None for non-existent keys
- This would reduce Redis operations from 2 to 1 (25% reduction per request)
- Includes example of simplified code
**Change:** Only added comment lines, no formatting changes.
## 2. Documentation Created
**File:** `REDIS_RATE_LIMITING_DOCUMENTATION.md`
Comprehensive documentation covering:
- Overview and architecture
- Configuration parameters
- Rate limiting mechanisms (authorized and anonymous)
- Redis data structure (keys, values, TTL)
- Implementation details of core functions
- API response headers
- Monitoring and debugging commands
- Error handling
- Performance considerations
**Note:** All Lua script references have been removed as requested.
## 3. Files Removed
- `REDIS_OPTIMIZATION_ANSWER.md` - Deleted (contained Lua-based optimization suggestions)
## Key Insight
**Q: Can we just use INCR instead of SET, INCR, and EXISTS?**
**A: Partially, yes:**
- ✅ EXISTS is redundant - GET returns None when key doesn't exist (25% reduction)
- ❌ Can't eliminate SETEX - INCR doesn't set TTL, and we need TTL for automatic counter reset
- Current pattern (SETEX for first call, INCR for subsequent calls) is correct for the Jedis wrapper
The TODO comment marks where the EXISTS optimization should be implemented.