Skip to content

Commit

Permalink
fixed race condition on channel close while go routine was sending (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelvocks authored Aug 23, 2018
1 parent d77be77 commit 374cc8d
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit 374cc8d

Please sign in to comment.