[ https://issues.apache.org/jira/browse/YUNIKORN-2835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated YUNIKORN-2835: ------------------------------------- Labels: pull-request-available (was: ) > Refactor switch statement in UpdateApplication > ---------------------------------------------- > > Key: YUNIKORN-2835 > URL: https://issues.apache.org/jira/browse/YUNIKORN-2835 > Project: Apache YuniKorn > Issue Type: Improvement > Components: shim - kubernetes > Reporter: Tzu-Hua Lan > Assignee: Tzu-Hua Lan > Priority: Trivial > Labels: pull-request-available > > The application state handling code in the UpdateApplication method of > AsyncRMCallback struct (in scheduler_callback.go) could be improved. > The current implementation uses a switch statement with a default case that > actually handles two specific states, which may not align with the typical > expectations for a default case. > Current implementation: > [link|https://github.com/apache/yunikorn-k8shim/blob/5bb3890580cc9865efc0d5d84f69f897d4775a3a/pkg/cache/scheduler_callback.go#L149-L154] > {code:go} > switch updated.State { > case ApplicationStates().Completed: > // ... > case ApplicationStates().Resuming: > // ... > default: > if updated.State == ApplicationStates().Failing || updated.State == > ApplicationStates().Failed { > // ... > } > } > {code} > Proposed implementation: > {code:go} > switch updated.State { > case ApplicationStates().Completed: > // ... > case ApplicationStates().Resuming: > // ... > case ApplicationStates().Failing, ApplicationStates().Failed: > // ... > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@yunikorn.apache.org For additional commands, e-mail: issues-h...@yunikorn.apache.org