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 commented Feb 18, 2021

Fixes #1233

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

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()

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🤷‍♂️

This was referenced Mar 9, 2021
This was referenced Mar 15, 2021
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