Skip to content

Commit

Permalink
fix(controller): Handling panic in leaderelection (argoproj#6072)
Browse files Browse the repository at this point in the history
Signed-off-by: Saravanan Balasubramanian <[email protected]>
  • Loading branch information
sarabala1979 committed Jun 3, 2021
1 parent 4f4b78e commit f8f63e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ var indexers = cache.Indexers{
// Run starts an Workflow resource controller
func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, workflowTTLWorkers, podWorkers, podCleanupWorkers int) {
defer runtimeutil.HandleCrash(runtimeutil.PanicHandlers...)

ctx, cancel := context.WithCancel(ctx)
defer cancel()

defer wfc.wfQueue.ShutDown()
defer wfc.podQueue.ShutDown()
defer wfc.podCleanupQueue.ShutDown()
Expand Down Expand Up @@ -240,7 +244,6 @@ func (wfc *WorkflowController) Run(ctx context.Context, wfWorkers, workflowTTLWo
}
logCtx := log.WithField("id", nodeID)

var cancel context.CancelFunc
leaderName := "workflow-controller"
if wfc.Config.InstanceID != "" {
leaderName = fmt.Sprintf("%s-%s", leaderName, wfc.Config.InstanceID)
Expand Down

0 comments on commit f8f63e6

Please sign in to comment.