Add NOSCRIPT error recovery for async operations#192
Conversation
…reregister scripts if fails
…truly rergister scripts
…cant reload script
…code for testing no script error
There was a problem hiding this comment.
Pull request overview
This pull request extends NOSCRIPT error recovery to async operations outside of pipeline contexts. The main change is adding automatic script re-registration and retry logic to the arun_sha() function, which is used by dict operations like apop() and apopitem(). The PR also introduces test fixtures to simplify NOSCRIPT recovery testing.
Changes:
- Added NOSCRIPT error recovery to
arun_sha()with automatic script re-registration and retry - Introduced
PersistentNoScriptErrorexception for cases where recovery fails - Added
flush_scriptsanddisable_noscript_recoverytest fixtures for cleaner testing
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rapyer/scripts/registry.py | Implements NOSCRIPT error recovery in arun_sha() with try-catch logic and raises PersistentNoScriptError on persistent failures |
| rapyer/base.py | Updates import to use module reference (scripts_registry) instead of direct function import |
| tests/integration/conftest.py | Adds flush_scripts fixture to flush scripts before tests and disable_noscript_recovery fixture to mock recovery for failure testing |
| tests/integration/pipeline/test_pipeline_noscript_recovery.py | Simplifies tests by using new fixtures instead of inline script flushing; removes unused imports |
| tests/integration/dct/test_redis_dict.py | Adds test for apop raising PersistentNoScriptError when recovery is disabled |
| CHANGELOG.md | Documents the new NOSCRIPT error recovery feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…redis and fake redis names
…redis for creating scripts
… check reloading scripts
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Extends NOSCRIPT error recovery to async operations outside pipeline context. When
arun_sha()encounters a NOSCRIPT error (e.g., after Redis restart), it now automatically re-registers Lua scripts and retries.Changes
arun_sha()recovery: Added try/catch forNoScriptErrorwith automatic script re-registration and retryPersistentNoScriptError: Raised when scripts fail to execute even after re-registration, indicating a server-side issueflush_scriptsfixture: Added test fixture to flush scripts before tests rather than mid-pipelineTesting
flush_scriptsfixturePersistentNoScriptErroris raised when recovery failsCloses #190