Skip to content

Commit

Permalink
chore: from recursion to iterative loop
Browse files Browse the repository at this point in the history
Signed-off-by: RealAnna <[email protected]>
  • Loading branch information
RealAnna committed Oct 10, 2022
1 parent b4a635c commit 17edbea
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions scheduler/pkg/klcpermit/permit.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ func (pl *Permit) Permit(ctx context.Context, state *framework.CycleState, p *v1
func (pl *Permit) monitorPod(ctx context.Context, p *v1.Pod) {
waitingPodHandler := pl.handler.GetWaitingPod(p.UID)

switch pl.workloadManager.Permit(ctx, p) {
case Failure:
waitingPodHandler.Reject(PluginName, "Pre Deployment Check failed")
case Success:
waitingPodHandler.Allow(PluginName)
default:
time.Sleep(10 * time.Second)
pl.monitorPod(ctx, p)
for {
switch pl.workloadManager.Permit(ctx, p) {
case Failure:
waitingPodHandler.Reject(PluginName, "Pre Deployment Check failed")
return
case Success:
waitingPodHandler.Allow(PluginName)
return
default:
time.Sleep(10 * time.Second)
}
}

}

// New initializes a new plugin and returns it.
Expand Down

0 comments on commit 17edbea

Please sign in to comment.