Skip to content

Conversation

@dcbickfo
Copy link
Owner

@dcbickfo dcbickfo commented Oct 6, 2025

  • It was possible for a channel to never be notified due to a dropped notification from redis
  • This prevents that from happening now
  • Also fixed an issue with appending to a slice

@dcbickfo dcbickfo marked this pull request as ready for review October 6, 2025 18:57
@dcbickfo dcbickfo requested a review from Copilot October 6, 2025 18:58
Copy link
Contributor

Copilot AI left a 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>
@dcbickfo dcbickfo requested a review from Copilot October 6, 2025 19:00
Copy link
Contributor

Copilot AI left a 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)
Copy link

Copilot AI Oct 6, 2025

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.

Copilot uses AI. Check for mistakes.
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...)
Copy link

Copilot AI Oct 6, 2025

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.

Copilot uses AI. Check for mistakes.
@dcbickfo dcbickfo merged commit 4cd27f1 into main Oct 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants