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

fix race condition AddHook and traces #1234

Merged
merged 1 commit into from Feb 18, 2021
Merged

fix race condition AddHook and traces #1234

merged 1 commit into from Feb 18, 2021

Conversation

@dgsb
Copy link
Collaborator

@dgsb dgsb commented Feb 17, 2021

No description provided.

@dgsb
Copy link
Collaborator Author

@dgsb dgsb commented Feb 18, 2021

Fixes #1233

Loading

@dgsb dgsb merged commit 6cff360 into master Feb 18, 2021
3 checks passed
Loading
@dgsb dgsb deleted the dbd-cleanup branch Feb 18, 2021
for k, v := range entry.Logger.Hooks {
tmpHooks[k] = v
}
entry.Logger.mu.Unlock()
Copy link
Contributor

@dolmen dolmen Mar 2, 2021

Choose a reason for hiding this comment

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

This could be simplified:

entry.Logger.mu.Lock()
tmpHooks := append(LevelHooks(nil), entry.Logger.Hooks...)
entry.Logger.mu.Unlock()

Loading

Copy link
Collaborator Author

@dgsb dgsb Mar 2, 2021

Choose a reason for hiding this comment

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

it may lead to more reallocation and copy depending on the array size though.

Loading

Copy link
Collaborator Author

@dgsb dgsb Mar 2, 2021

Choose a reason for hiding this comment

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

or not

Loading

Copy link
Collaborator Author

@dgsb dgsb Mar 2, 2021

Choose a reason for hiding this comment

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

🤷‍♂️

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants