Skip to content

Commit

Permalink
refactor: wait job handling
Browse files Browse the repository at this point in the history
  • Loading branch information
miyamo2 committed Nov 30, 2024
1 parent b08d79d commit b8eaba7
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions cmd/create_transient_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ func (o *TransientConfigMapOptions) Run(cmd *cobra.Command) (err error) {
go func() {
waitJobCompleteArgs := append(waitJobArgs, jobName, "--for=condition=complete")
_, wErr := executeKubectlCommand(waitJobContext, waitJobCompleteArgs...)
if wErr != nil {
select {
case <-waitJobContext.Done():
return
default:
select {
case <-waitJobContext.Done():
return
default:
if wErr != nil {
if err == nil {
err = wErr
}
Expand All @@ -284,14 +284,12 @@ func (o *TransientConfigMapOptions) Run(cmd *cobra.Command) (err error) {
go func() {
waitJobFailedArgs := append(waitJobArgs, jobName, "--for=condition=failed")
_, wErr := executeKubectlCommand(waitJobContext, waitJobFailedArgs...)
if wErr != nil {
select {
case <-waitJobContext.Done():
return
default:
if err == nil {
err = wErr
}
select {
case <-waitJobContext.Done():
return
default:
if wErr != nil && err == nil {
err = wErr
}
}
complete <- false
Expand Down

0 comments on commit b8eaba7

Please sign in to comment.