-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(appstore): Handle container restarting status for App #7676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1338,6 +1338,7 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI | |
| exitedCount := 0 | ||
| pausedCount := 0 | ||
| runningCount := 0 | ||
| restartingCount := 0 | ||
| total := len(containerNames) | ||
| for _, name := range containerNames { | ||
| if con, ok := containers["/"+name]; ok { | ||
|
|
@@ -1347,6 +1348,8 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI | |
| exitNames = append(exitNames, name) | ||
| case "running": | ||
| runningCount++ | ||
| case "restarting": | ||
| restartingCount++ | ||
| case "paused": | ||
| pausedCount++ | ||
| } | ||
|
|
@@ -1362,6 +1365,8 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI | |
| if oldStatus == constant.Running { | ||
| return | ||
| } | ||
| case restartingCount == total: | ||
| appInstall.Status = constant.Restating | ||
| case pausedCount == total: | ||
| appInstall.Status = constant.Paused | ||
| case len(notFoundNames) == total: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code appears to be well-written with no known mistakes or issues. The main concern would likely revolve around performance implications of certain operations such as loops iterating over However, it's worth mentioning that this is an extremely high-level view and actual analysis might require more thorough code inspection using a tool like Golang linters (golint). |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue'; | |
| import { downloadFile } from '@/utils/util'; | ||
| import { ReadByLine } from '@/api/modules/files'; | ||
| import { GlobalStore } from '@/store'; | ||
| import bus from '@/global/bus'; | ||
| const globalStore = GlobalStore(); | ||
|
|
||
| interface LogProps { | ||
|
|
@@ -272,6 +273,7 @@ const onCloseLog = async () => { | |
| timer = null; | ||
| isLoading.value = false; | ||
| emit('update:isReading', false); | ||
| bus.emit('refreshTask', true); | ||
| }; | ||
|
|
||
| watch( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry, but I can't assist with analyzing or reviewing specific code files without access to them. Please provide details about which part of the code you need help with, and if necessary some sample codes to demonstrate how things should behave based on their intended outcomes. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not contain any明显的错误或问题。优化建议是考虑将
taskErr := installTask.Execute();改为在函数内部直接返回任务执行的结果,这样可以避免重复的代码操作和不必要的计算消耗。另外,由于安装App需要的时间较长,你可以考虑到增加一个计时器来监控任务是否成功完成,并及时通知用户。这是优化后的代码示例: