-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dvovk/headers info #9748
dvovk/headers info #9748
Conversation
dvovk
commented
Mar 18, 2024
- collecting info for "Headers" stage
erigon-lib/diagnostics/headers.go
Outdated
ctx, ch, cancel := Context[HeaderCanonicalMarkerUpdate](context.Background(), 1) | ||
defer cancel() | ||
|
||
rootCtx, _ := common.RootContext() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
common.RootContext()
- it's not global variable access - it's constructor. and better don't have more than 1 root context.
please pass existing root context toDiagnosticClient
constructor. save it as field and use here.
(feel free to rename RootContext to NewRootContext) -
cancel 1 context based on another one - it's anti-pattern:
case <-rootCtx.Done():
cancel()
better establish child-parent relationship between contexts: Context[HeaderCanonicalMarkerUpdate](context.Background()
-> Context[HeaderCanonicalMarkerUpdate](rootCtx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Quality Gate passedIssues Measures |