mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-09 15:06:37 +08:00
fix: Fix backup record loading timeout issue (#10126)
This commit is contained in:
parent
dd6a709053
commit
00b25b39c5
6 changed files with 116 additions and 101 deletions
|
@ -1080,7 +1080,7 @@ func runScript(task *task.Task, appInstall *model.AppInstall, operate string) er
|
|||
task.LogStart(logStr)
|
||||
|
||||
cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(10*time.Minute), cmd.WithWorkDir(workDir))
|
||||
out, err := cmdMgr.RunWithStdoutBashCf(scriptPath)
|
||||
out, err := cmdMgr.RunWithStdoutBashC(scriptPath)
|
||||
if err != nil {
|
||||
if out != "" {
|
||||
err = errors.New(out)
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||
|
@ -256,13 +257,25 @@ func (u *BackupRecordService) LoadRecordSize(req dto.SearchForSize) ([]dto.Recor
|
|||
|
||||
var datas []dto.RecordFileSize
|
||||
var wg sync.WaitGroup
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
for i := 0; i < len(list); i++ {
|
||||
datas = append(datas, dto.RecordFileSize{ID: list[i].ID})
|
||||
if val, ok := clientMap[fmt.Sprintf("%v", list[i].DownloadID)]; ok {
|
||||
wg.Add(1)
|
||||
go func(index int) {
|
||||
defer wg.Done()
|
||||
done := make(chan struct{}, 1)
|
||||
go func() {
|
||||
datas[index].Size, _ = val.client.Size(path.Join(val.backupPath, list[i].FilePath))
|
||||
wg.Done()
|
||||
defer close(done)
|
||||
}()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-done:
|
||||
return
|
||||
}
|
||||
}(i)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3366,7 +3366,7 @@ func (w WebsiteService) ExecComposer(req request.ExecComposerReq) error {
|
|||
execDir := strings.ReplaceAll(req.Dir, siteDir.Value, "/www")
|
||||
composerTask.AddSubTask("", func(t *task.Task) error {
|
||||
cmdStr := fmt.Sprintf("docker exec -u %s %s sh -c 'composer config -g repo.packagist composer %s && composer %s --working-dir=%s'", req.User, runtime.ContainerName, req.Mirror, command, execDir)
|
||||
err = cmdMgr.RunBashCf(cmdStr)
|
||||
err = cmdMgr.RunBashC(cmdStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
:data="data"
|
||||
:heightDiff="300"
|
||||
>
|
||||
<el-table-column type="selection" fix />
|
||||
<el-table-column type="selection" :selectable="selectable" fix />
|
||||
<el-table-column
|
||||
:label="$t('cronjob.taskName')"
|
||||
:min-width="120"
|
||||
|
@ -307,6 +307,10 @@ const onOpenDialog = async (id: string) => {
|
|||
routerToNameWithQuery('CronjobOperate', { id: id });
|
||||
};
|
||||
|
||||
function selectable(row) {
|
||||
return row.status !== 'Pending';
|
||||
}
|
||||
|
||||
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
||||
let names = [];
|
||||
let ids = [];
|
||||
|
|
|
@ -86,8 +86,9 @@
|
|||
</template>
|
||||
<template #main>
|
||||
<div class="mainClass">
|
||||
<el-row :gutter="20" v-show="hasRecords" class="mainRowClass">
|
||||
<el-row :gutter="20" v-show="hasRecords" class="mainRowClass row-box">
|
||||
<el-col :span="7">
|
||||
<el-card class="el-card">
|
||||
<div class="infinite-list" style="overflow: auto">
|
||||
<el-table
|
||||
style="cursor: pointer"
|
||||
|
@ -116,14 +117,16 @@
|
|||
@current-change="handleCurrentChange"
|
||||
@size-change="handleSizeChange"
|
||||
:pager-count="5"
|
||||
:page-sizes="[6, 8, 10, 12, 14]"
|
||||
:page-sizes="[5, 10, 20, 50, 100, 200, 500, 1000]"
|
||||
small
|
||||
layout="total, sizes, prev, pager, next"
|
||||
:total="searchInfo.recordTotal"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="17">
|
||||
<el-card class="el-card">
|
||||
<el-form label-position="top">
|
||||
<el-row type="flex" justify="center">
|
||||
<el-form-item class="descriptionWide">
|
||||
|
@ -169,7 +172,7 @@
|
|||
class="w-full"
|
||||
:key="currentRecord?.taskID"
|
||||
@stop-reading="search(false)"
|
||||
:heightDiff="410"
|
||||
:heightDiff="420"
|
||||
:config="{
|
||||
type: 'task',
|
||||
colorMode: 'task',
|
||||
|
@ -179,6 +182,7 @@
|
|||
/>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -410,7 +414,7 @@ defineExpose({
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.infinite-list {
|
||||
height: calc(100vh - 420px);
|
||||
height: calc(100vh - 320px);
|
||||
.select-sign {
|
||||
&::before {
|
||||
float: left;
|
||||
|
@ -449,10 +453,4 @@ defineExpose({
|
|||
min-width: 1200px;
|
||||
}
|
||||
}
|
||||
.editor-main {
|
||||
height: calc(100vh - 488px);
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -646,7 +646,7 @@ onBeforeUnmount(() => {
|
|||
|
||||
.h-systemInfo {
|
||||
margin-left: 18px;
|
||||
height: 276px;
|
||||
height: 286px;
|
||||
}
|
||||
@-moz-document url-prefix() {
|
||||
.h-systemInfo {
|
||||
|
|
Loading…
Add table
Reference in a new issue