This is an automated email from the ASF dual-hosted git repository.

zhuqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 88bb82c7 refactor if-else to switch statement (#731)
88bb82c7 is described below

commit 88bb82c7867f42bff318be9e76695c37250ce0b2
Author: targetoee <[email protected]>
AuthorDate: Fri Nov 24 14:45:44 2023 +0800

    refactor if-else to switch statement (#731)
    
    Closes: #731
    
    Signed-off-by: qzhu <[email protected]>
---
 pkg/scheduler/objects/application.go | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkg/scheduler/objects/application.go 
b/pkg/scheduler/objects/application.go
index caa0a162..086f0219 100644
--- a/pkg/scheduler/objects/application.go
+++ b/pkg/scheduler/objects/application.go
@@ -1687,11 +1687,12 @@ func (sa *Application) decUserResourceUsage(resource 
*resources.Resource, remove
 
 // Track used and preempted resources
 func (sa *Application) trackCompletedResource(info *Allocation) {
-       if info.IsPreempted() {
+       switch {
+       case info.IsPreempted():
                sa.updatePreemptedResource(info)
-       } else if info.IsPlaceholder() {
+       case info.IsPlaceholder():
                sa.updatePlaceholderResource(info)
-       } else {
+       default:
                sa.updateUsedResource(info)
        }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to