fix: reload Lua scripts after Redis NOSCRIPT#17
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR adds resilience to Redis Lua script execution. ChangesRedis Lua Script NOSCRIPT Resilience
Sequence DiagramsequenceDiagram
participant Caller
participant evalScript
participant Cache
participant Redis as Redis Client
Caller->>evalScript: evalScript(client, scriptName, args)
evalScript->>Cache: lookup SHA for script
evalScript->>Redis: evalsha(sha, args)
Redis-->>evalScript: NOSCRIPT error
evalScript->>Cache: delete SHA
evalScript->>Redis: script('load', scriptCode)
Redis-->>evalScript: new SHA
evalScript->>Redis: evalsha(newSha, args)
Redis-->>evalScript: result
evalScript-->>Caller: result
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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 |
Summary\n- retry GroupMQ Lua evals once when Redis returns NOSCRIPT\n- clear the stale client-side SHA cache before reloading the script\n- add unit coverage for retry and non-NOSCRIPT error behavior\n- add an integration regression for SCRIPT FLUSH with a real Redis connection\n\n## Context\nRedis Lua script cache is volatile across restarts, failovers, and SCRIPT FLUSH. GroupMQ caches SCRIPT LOAD SHA values client-side, so a stale SHA can make every queue operation fail until the process restarts.\n\n## Verification\n- npx pnpm@10.18.3 exec vitest run test/lua-loader.test.ts\n- npx pnpm@10.18.3 run build\n\nNote: full typecheck currently fails on existing queue.corrupted-jobs.test.ts typing errors unrelated to this change.
Summary by CodeRabbit
Bug Fixes
Tests