-
Notifications
You must be signed in to change notification settings - Fork 0
Fix Indefinite Wait #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue where channels could wait indefinitely due to dropped Redis invalidation notifications. The fix implements a timeout mechanism to prevent indefinite waits and improves context handling.
- Replaced simple channels with lockEntry struct containing context and cancel function for better lifecycle management
- Added automatic timeout mechanism using context.WithTimeout to prevent indefinite waits
- Improved error handling and context cancellation throughout the codebase
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cacheaside.go | Core implementation changes replacing channel-based locks with context-based lockEntry system and timeout handling |
| cacheaside_test.go | Added test case to verify proper parent context cancellation behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| defer cancel() | ||
| rca.unlock(toCtx, key, lockVal) | ||
| // Best effort unlock - errors are non-fatal as lock will expire | ||
| _ = rca.unlock(toCtx, key, lockVal) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error from unlock is being silently discarded. Consider logging the error for debugging purposes while maintaining the non-fatal behavior.
| defer wg.Done() | ||
| delKeyLua.ExecMulti(ctx, rca.client, stmts...) | ||
| // Best effort unlock - errors are non-fatal as locks will expire | ||
| _ = delKeyLua.ExecMulti(ctx, rca.client, stmts...) |
Copilot
AI
Oct 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the single unlock, the error from unlockMulti is being silently discarded. Consider logging the error for debugging purposes while maintaining the non-fatal behavior.
Uh oh!
There was an error while loading. Please reload this page.