Open
Conversation
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
7e0ee53 to
ff64d28
Compare
bwplotka
reviewed
Jul 27, 2021
Owner
bwplotka
left a comment
There was a problem hiding this comment.
Looks good so far! Thanks, some comments.
| f := New(ctx, opts...) | ||
| b := bytes.Buffer{} | ||
| // TODO(bwplotka): Add concurrency (collector will need to redone). | ||
| errorChannel := make(chan error) |
Owner
There was a problem hiding this comment.
Suggested change
| errorChannel := make(chan error) | |
| errorCh := make(chan error) |
| spin.Message(fn + "...") | ||
| } | ||
| errs.Add(func() error { | ||
| go func(fn string) { |
Owner
There was a problem hiding this comment.
Let's use https://pkg.go.dev/golang.org/x/sync/errgroup maybe, so semantics are easier.
| return | ||
| } | ||
| v.destFutures[k] = &futureResult{cases: 1, resultFn: func() error { return nil }} | ||
|
|
Owner
There was a problem hiding this comment.
I think there is a race during replacement operation.
| func (v RoundTripValidator) IsValid(k futureKey, r *validator) (bool, error) { | ||
| // Result will be in future. | ||
| r.destFutures[k].resultFn = func() error { return r.remoteLinks[k.dest] } | ||
| prevResult, _ := r.destFutures.LoadAndDelete(k) |
Owner
There was a problem hiding this comment.
Lot's of races when we delete, unfortunately.. we need to make this operation locked potentially with Mutex.
But it has to be the full operation Locked:
- Checking if there is entry in map
- If no, create new future, and schedule colly
- If yes, grab reference to future
We might need to check IsValid interface, if this actually allows us to do this 🤔
Owner
|
Still comments not addressed, I believe? |
1 task
Owner
|
Any progress? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR parallelizes the file processing loop in
mdformatterfor faster formatting and link checking usingWaitGroupby spawning a goroutine for each file. (This also changes CLI spinner behavior as filenames cannot be shown due to multiple files being processed at once)Some caveats,
v.c.Wait()(flaky, maybe due to internal colly WaitGroup)