[FIX] Add missing SentinelConnectionFactory for Redis Sentinel cache#1855
[FIX] Add missing SentinelConnectionFactory for Redis Sentinel cache#1855
Conversation
… cache PR #1854 added CONNECTION_POOL_CLASS but missed CONNECTION_FACTORY, causing the default ConnectionFactory to create SentinelConnectionPool via from_url() without the required service_name and sentinel_manager arguments — crashing migrations at import time. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughAdded CONNECTION_FACTORY configuration option to Django Redis Sentinel cache settings to explicitly specify SentinelConnectionFactory for Sentinel-based Redis connection management. This is a single-line configuration update with no logic changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
Greptile SummaryThis PR adds the missing Key changes:
Note: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant DjangoApp as Django App
participant RedisCache as django_redis RedisCache
participant Factory as ConnectionFactory (before fix)
participant SentinelFactory as SentinelConnectionFactory (after fix)
participant Pool as SentinelConnectionPool
participant Sentinel as Redis Sentinel
Note over DjangoApp,Sentinel: Before fix (crashes on migration)
DjangoApp->>RedisCache: cache.get(key)
RedisCache->>Factory: get_connection_pool(url)
Factory->>Pool: SentinelConnectionPool.from_url(url)
Pool-->>Factory: TypeError: missing service_name & sentinel_manager
Factory-->>DjangoApp: ❌ Crash
Note over DjangoApp,Sentinel: After fix (works correctly)
DjangoApp->>RedisCache: cache.get(key)
RedisCache->>SentinelFactory: get_connection_pool(url)
SentinelFactory->>SentinelFactory: parse service_name from LOCATION URL
SentinelFactory->>Pool: SentinelConnectionPool(service_name, sentinel_manager)
Pool->>Sentinel: connect to sentinel host:port
Sentinel-->>Pool: return master address
Pool-->>SentinelFactory: pool ready
SentinelFactory-->>DjangoApp: ✅ Connection established
Last reviewed commit: 0d416db |
|



Summary
TypeError: SentinelConnectionPool.__init__() missing 2 required positional arguments: 'service_name' and 'sentinel_manager'CONNECTION_POOL_CLASSto the Django CACHES config but missed addingCONNECTION_FACTORY, so the defaultConnectionFactorytried to createSentinelConnectionPoolviafrom_url()without the required Sentinel arguments"CONNECTION_FACTORY": "django_redis.pool.SentinelConnectionFactory"which properly injectsservice_nameandsentinel_managerbefore pool creationTest plan
REDIS_SENTINEL_MODE=Trueand verify migrations run successfullyCacheServiceif REDIS_SENTINEL_MODE:branch)🤖 Generated with Claude Code