Skip to content
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

Skip processing on closed result channel, fix panic #215

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ func (executor *ParallelExecutor) Execute(ctx *ExecutionContext) (map[string]int
for {
select {
// we have a new result
case payload := <-resultCh:
case payload, ok := <-resultCh:
if !ok {
return
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me how to introduce a test for this scenario. It does seem like restructuring channels/wait groups/locks may be in order for a more modular and testable execution flow.

ctx.logger.Debug("Inserting result into ", payload.InsertionPoint)
ctx.logger.Debug("Result: ", payload.Result)

Expand Down
Loading