[medium] don't conditionally run killDupAgents routine

We need to make sure we are actively draining the DetectDupAgents
channel, otherwise routines writing here will end up blocking. We
check the ctx.Agent.KillDupAgents setting inside killDupAgents, so just
send the queue location here and it will be handled according to the
configuration value.
This commit is contained in:
Aaron Meihm 2016-04-13 21:14:47 -05:00
Родитель ce85886a8e
Коммит d5bf8854b8
1 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -267,18 +267,16 @@ func startRoutines(ctx Context) {
ctx.Channels.Log <- mig.Log{Desc: "queue cleanup routine started"}
// launch the routine that handles multi agents on same queue
if ctx.Agent.KillDupAgents {
go func() {
for queueLoc := range ctx.Channels.DetectDupAgents {
ctx.OpID = mig.GenID()
err = killDupAgents(queueLoc, ctx)
if err != nil {
ctx.Channels.Log <- mig.Log{Desc: fmt.Sprintf("%v", err)}.Err()
}
go func() {
for queueLoc := range ctx.Channels.DetectDupAgents {
ctx.OpID = mig.GenID()
err = killDupAgents(queueLoc, ctx)
if err != nil {
ctx.Channels.Log <- mig.Log{Desc: fmt.Sprintf("%v", err)}.Err()
}
}()
ctx.Channels.Log <- mig.Log{Desc: "killDupAgents() routine started"}
}
}
}()
ctx.Channels.Log <- mig.Log{Desc: "killDupAgents() routine started"}
// launch the routine that heartbeats the relays and terminates if connection is lost
go func() {