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

optimize: revise lock in cb metric #202

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ppzqh
Copy link
Collaborator

@ppzqh ppzqh commented Feb 4, 2024

No description provided.

@@ -116,27 +116,29 @@ func (w *window) Succeed() {

// Fail records a failure in the current perPBucket.
func (w *window) Fail() {
w.rw.Lock()
rwx := w.rw.RLocker()
rwx.Lock()
b := w.getBucket()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If getBucket is a readonly op, it can be moved out of the critical zone.

@@ -116,27 +116,29 @@ func (w *window) Succeed() {

// Fail records a failure in the current perPBucket.
func (w *window) Fail() {
w.rw.Lock()
rwx := w.rw.RLocker()
rwx.Lock()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since all the operations are atomic ops, is it really a need to lock here?

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.

None yet

2 participants