Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes the duplicate and incorrect SHA output by placing the manifest to be deleted in an anonymous function's parameter and immediately invoking. IMO this makes the call stack more clear and safer. Any future refactors can access any of the parameters on the manifest variable without worrying about thread safety. That said, I completely understand this is a nitpick. This just came about from me debugging why
v0.7.0
was printing the same SHA and sometimes even the wrong SHA occasionally. However, I still wanted to propose the revision to the community.Background
Commit 834f5cbd9 fixed an issue where duplicate and potentially wrong SHAs were output. The crux of the bug was that the pool functions tried to access the
m
variable that was declared in the for loop. Since this pointer changed what manifest it was pointing at, it wasn't thread safe. The pool functions would just output the digest of the manifest they were on, This usually manifested as duplicates but sometimes as the wrong SHA.The fix for this issue was to store the ref variable directly on the call stack. Since the pool functions no longer were using a pointer of a pointer (m.Digest) that changes during iteration, the calls are safe