-
Notifications
You must be signed in to change notification settings - Fork 784
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
[repo] Small cleanup/simplification #6048
base: main
Are you sure you want to change the base?
Conversation
src/OpenTelemetry.Exporter.OpenTelemetryProtocol/PersistentStorage/DirectorySizeTracker.cs
Outdated
Show resolved
Hide resolved
@pentp There's some stuff on here I would be happy to merge. Like adding |
@@ -404,7 +404,10 @@ static void InnerTest() | |||
getTracerThread.Join(); | |||
} | |||
|
|||
Assert.Empty(tracers); | |||
foreach (var kvp in tracers) |
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.
@pentp Can you explain why this test is changing? For simple cleanup/simplification work I would expect all the tests to pass as they did before so this worries me a bit 😄
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.
It's changing because I removed the ConcurrentDictionary.Clear()
call here.
It's unnecessary from a functional perspective (the dictionary isn't used in any way after the class field is nulled out) and somewhat expensive - it takes all the locks and allocates new backing arrays which can be potentially quite large: https://source.dot.net/#System.Collections.Concurrent/System/Collections/Concurrent/ConcurrentDictionary.cs,108c257ef528517e
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.
Should I restore the Clear()
call?
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Some basic cleanup and simplification.