Skip to content

Commit 88bb82c

Browse files
targetoeezhuqi-lucas
authored andcommitted
refactor if-else to switch statement (apache#731)
Closes: apache#731 Signed-off-by: qzhu <[email protected]>
1 parent a9dcab4 commit 88bb82c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/scheduler/objects/application.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -1687,11 +1687,12 @@ func (sa *Application) decUserResourceUsage(resource *resources.Resource, remove
16871687

16881688
// Track used and preempted resources
16891689
func (sa *Application) trackCompletedResource(info *Allocation) {
1690-
if info.IsPreempted() {
1690+
switch {
1691+
case info.IsPreempted():
16911692
sa.updatePreemptedResource(info)
1692-
} else if info.IsPlaceholder() {
1693+
case info.IsPlaceholder():
16931694
sa.updatePlaceholderResource(info)
1694-
} else {
1695+
default:
16951696
sa.updateUsedResource(info)
16961697
}
16971698
}

0 commit comments

Comments
 (0)