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

fixed race condition on channel close while go routine was sending #85

Merged
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
fixed race condition on channel close while go routine was sending
  • Loading branch information
michelvocks committed Aug 22, 2018
commit 26ba7e68cb79d17d6932ef0a9c0034131f88d7f7
11 changes: 11 additions & 0 deletions scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,17 @@ func (s *Scheduler) executeScheduler(r *gaia.PipelineRun, pS Plugin) {
// Send done signal to all resolvers
close(done)

// read all jobs which are waiting to be executed to free the channel
var channelClean = false
for !channelClean {
select {
case <-executeScheduler:
// just read from the channel
default:
channelClean = true
}
}

// Close executeScheduler. No new jobs should be scheduled.
close(executeScheduler)

Expand Down