Skip to content
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

kvcache: optimize View() method and fix redundant atomic store #13906

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VolodymyrBg
Copy link

The commit improves the View() method in the kvcache package by:

  1. Removing redundant atomic store operation in OnNewBlock() after CompareAndSwap
  2. Adding proper lock protection when accessing shared state in View()
  3. Using time.NewTimer instead of time.After to prevent potential goroutine leaks
  4. Optimizing ready state check flow to reduce lock contention

The changes make the code more efficient while maintaining thread safety.

The commit improves the View() method in the kvcache package by:
1. Removing redundant atomic store operation in OnNewBlock() after CompareAndSwap
2. Adding proper lock protection when accessing shared state in View()
3. Using time.NewTimer instead of time.After to prevent potential goroutine leaks
4. Optimizing ready state check flow to reduce lock contention

The changes make the code more efficient while maintaining thread safety.
@VolodymyrBg
Copy link
Author

@AskAlexSharov Done

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