craigcondit commented on code in PR #565:
URL: https://github.com/apache/yunikorn-k8shim/pull/565#discussion_r1155347403
##########
pkg/appmgmt/appmgmt_recovery.go:
##########
@@ -71,33 +71,47 @@ func (svc *AppManagementService) recoverApps()
(map[string]interfaces.ManagedApp
return recoveringApps, nil
}
-func (svc *AppManagementService) waitForAppRecovery(
- recoveringApps map[string]interfaces.ManagedApp, maxTimeout
time.Duration) error {
- if len(recoveringApps) > 0 {
- log.Logger().Info("wait for app recovery",
- zap.Int("appToRecover", len(recoveringApps)))
- // check app states periodically, ensure all apps exit from
recovering state
- if err := utils.WaitForCondition(func() bool {
- for _, app := range recoveringApps {
- log.Logger().Debug("appInfo",
- zap.String("appId",
app.GetApplicationID()),
- zap.String("state",
app.GetApplicationState()))
- if app.GetApplicationState() ==
cache.ApplicationStates().Accepted {
- delete(recoveringApps,
app.GetApplicationID())
- }
- }
-
- if len(recoveringApps) == 0 {
- log.Logger().Info("app recovery is successful")
- return true
- }
-
+func (svc *AppManagementService) waitForAppRecovery(recoveringApps
map[string]interfaces.ManagedApp) bool {
+ svc.cancelRecovery.Store(false) // reset cancellation token
+ recoveryStartTime := time.Now()
+ counter := 0
+ for {
+ // check for cancellation token
+ if svc.cancelRecovery.Load() {
+ log.Logger().Info("Waiting for recovery canceled.")
+ svc.cancelRecovery.Store(false)
Review Comment:
Specifically, TestAppStatesDuringRecovery.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]