fix(cache): resolve scanning stop issue and add cache TTL management

- Fix Redis SCAN cursor type conversion (Buffer to String) to prevent early termination
- Add progress logging in initializeClubCache (every 100 activities with summary)
- Add Redis memory limits (512MB with LRU eviction policy)
- Implement cache TTL: 24h for normal data, 1h for error states (allows retry)
- Fix Docker permission issue by running app container as root
- Add TTL configuration to .env and example.env

Root cause: SCAN cursor comparison failed due to type mismatch (Buffer vs String)
Impact: Scanning now processes all 5000+ IDs instead of stopping at ~300
This commit is contained in:
JamesFlare1212
2026-04-06 21:03:30 -04:00
parent ee8cccc755
commit 32dee6b161
5 changed files with 91 additions and 18 deletions

View File

@@ -18,6 +18,9 @@ services:
context: .
dockerfile: Dockerfile
container_name: dsas-cca-backend
# Run as root to allow writing to volume-mounted cookies.json
# Alternative: Use named volume instead of bind mount
user: "0:0"
ports:
- "${PORT:-3000}:${PORT:-3000}"
env_file:
@@ -51,7 +54,8 @@ services:
redis:
image: "redis:8.0-alpine"
container_name: dsas-cca-redis
command: redis-server --requirepass "dsas-cca"
# Add memory limits to prevent OOM
command: redis-server --requirepass "dsas-cca" --maxmemory 512mb --maxmemory-policy allkeys-lru
volumes:
- ./redis_data:/data
restart: unless-stopped