-
Notifications
You must be signed in to change notification settings - Fork 213
NO-JIRA: task graph: test speedup and code cleaup #1101
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -949,7 +949,6 @@ func TestRunGraph(t *testing.T) { | |
| callbacks: map[string]callbackFn{ | ||
| "a": func(t *testing.T, name string, ctx context.Context, cancelFn func()) error { | ||
| cancelFn() | ||
| time.Sleep(time.Second) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd added this with the test-case back in eaa3d19 (#255). I didn't talk about the |
||
| return nil | ||
| }, | ||
| "*": func(t *testing.T, name string, ctx context.Context, cancelFn func()) error { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
NIT:
With
submitted[runTask.index] = falseremoved, perhaps we can update the comment as well?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.
The important part is still the "remove any work from the queue" though - that needs to stay. The channel gets drained (eventually...).
I'm not convinced about the usefulness of mentioning the submitted records - it explains the absence of code, but that only makes sense attached to a commit/code change, does not make that much sense in the actual code? "We are not doing something because it does not need to be done"-like comment IMO makes sense only if that absence is actually surprising, which does not seem to be the case here?
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.
I think i got it now.
"remove any work from the queue ourselves" corresponds to
<-workCh(that is why they stay in the same line).My mistake was I thought the comment was for the code below, currently having only
inflight--which i couldn't relate to the comment. Actually,inflight--is the additional things we need to do when<-workChtakes place.I got the point.
It would probably surprise the author of "submitted[runTask.index] = false". 😉 When we push a task, we do
submitted[nextNode] = true, my intuitive feeling is that we would set it to false when it is removed from the queue before the task is completed. With a comment, it would be telling that we do not do it intentionally, instead of forgetting it. Maybe it is just me. Just a NIT anyway.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.
😁
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.
I'm the author of that line, in 632e763 (#455), and Petr's "We never submit more work once canceled..." makes sense to me, and if I
git blame ...the line with the comment, I'll find his commit message, so all good on that side :)