Skip to content

Commit

Permalink
fix(provider): remove waitgroup for lease withdraw (#1618)
Browse files Browse the repository at this point in the history
fixes #eng-282

Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored Jun 16, 2022
1 parent 02ea8c9 commit 5b4883c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions provider/balance_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ func (bc *balanceChecker) run(startCh chan<- error) {
<-lState.tm.C
}
}

bc.log.Debug("shutdown complete")
}()

leaseCheckCh := make(chan leaseCheckResponse, 1)
Expand Down Expand Up @@ -308,8 +310,6 @@ loop:
}
}
}

bc.log.Debug("shutdown complete")
}

func (bc *balanceChecker) timerFunc(ctx context.Context, d time.Duration, lid mtypes.LeaseID, scheduledWithdraw bool, ch chan<- leaseCheckResponse) *time.Timer {
Expand Down
15 changes: 5 additions & 10 deletions provider/cluster/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,14 @@ loop:
dm.log.Debug("read from runch during shutdown")
}

dm.log.Debug("waiting on dm.wg")
dm.wg.Wait()

if nil != dm.withdrawal {
dm.log.Debug("waiting on withdrawal")
dm.withdrawal.lc.Shutdown(nil)
<-dm.withdrawal.lc.Done()
}

dm.log.Debug("waiting on dm.wg")
dm.wg.Wait()

dm.log.Info("shutdown complete")
}

Expand All @@ -256,12 +257,6 @@ func (dm *deploymentManager) startWithdrawal() error {
return err
}

dm.wg.Add(1)
go func() {
defer dm.wg.Done()
<-dm.lc.Done()
}()

return nil
}

Expand Down

0 comments on commit 5b4883c

Please sign in to comment.