## Description Make the $velma Redis connection pool size configurable via `REDIS_VELMA_SIZE` environment variable (default: 5, matching current behavior) The $velma pool is used exclusively by Rack::Attack for rate limiting and was the only Redis pool with a hardcoded size ## Fixes Under high traffic, the hardcoded $velma pool (size: 5) causes connection contention. Every HTTP request passes through Rack::Attack middleware, which requires a $velma Redis connection. When `WEB_CONCURRENCY=2` and `RAILS_MAX_THREADS=10` (20 concurrent threads), the 4:1 thread-to-connection ratio causes threads to queue for up to 1 second (the pool timeout), resulting in intermittent request latency spikes during traffic bursts. The $alfred pool was already configurable via REDIS_ALFRED_SIZE — this change brings $velma to parity. ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: changes only Redis connection pool sizing for Rack::Attack; misconfiguration could cause rate-limiting Redis contention or extra connections but no data/auth logic changes. > > **Overview** > Makes the `velma` Redis connection pool (used by Rack::Attack) configurable via a new `REDIS_VELMA_SIZE` env var, replacing the previously hardcoded pool size. > > Documents `REDIS_VELMA_SIZE` in `.env.example` alongside the existing `REDIS_ALFRED_SIZE` setting. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit dcbc946f2e1d7356dc743178ca46cdf12cb25c78. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Vishnu Narayanan <iamwishnu@gmail.com>
9.9 KiB
9.9 KiB