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)
|
task.LogStart(logStr)
|
||||||
|
|
||||||
cmdMgr := cmd.NewCommandMgr(cmd.WithTimeout(10*time.Minute), cmd.WithWorkDir(workDir))
|
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 err != nil {
|
||||||
if out != "" {
|
if out != "" {
|
||||||
err = errors.New(out)
|
err = errors.New(out)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
"github.com/1Panel-dev/1Panel/agent/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
"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 datas []dto.RecordFileSize
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
|
defer cancel()
|
||||||
for i := 0; i < len(list); i++ {
|
for i := 0; i < len(list); i++ {
|
||||||
datas = append(datas, dto.RecordFileSize{ID: list[i].ID})
|
datas = append(datas, dto.RecordFileSize{ID: list[i].ID})
|
||||||
if val, ok := clientMap[fmt.Sprintf("%v", list[i].DownloadID)]; ok {
|
if val, ok := clientMap[fmt.Sprintf("%v", list[i].DownloadID)]; ok {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(index int) {
|
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))
|
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)
|
}(i)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3366,7 +3366,7 @@ func (w WebsiteService) ExecComposer(req request.ExecComposerReq) error {
|
||||||
execDir := strings.ReplaceAll(req.Dir, siteDir.Value, "/www")
|
execDir := strings.ReplaceAll(req.Dir, siteDir.Value, "/www")
|
||||||
composerTask.AddSubTask("", func(t *task.Task) error {
|
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)
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
:data="data"
|
:data="data"
|
||||||
:heightDiff="300"
|
:heightDiff="300"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" fix />
|
<el-table-column type="selection" :selectable="selectable" fix />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="$t('cronjob.taskName')"
|
:label="$t('cronjob.taskName')"
|
||||||
:min-width="120"
|
:min-width="120"
|
||||||
|
@ -307,6 +307,10 @@ const onOpenDialog = async (id: string) => {
|
||||||
routerToNameWithQuery('CronjobOperate', { id: id });
|
routerToNameWithQuery('CronjobOperate', { id: id });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function selectable(row) {
|
||||||
|
return row.status !== 'Pending';
|
||||||
|
}
|
||||||
|
|
||||||
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
const onDelete = async (row: Cronjob.CronjobInfo | null) => {
|
||||||
let names = [];
|
let names = [];
|
||||||
let ids = [];
|
let ids = [];
|
||||||
|
|
|
@ -86,8 +86,9 @@
|
||||||
</template>
|
</template>
|
||||||
<template #main>
|
<template #main>
|
||||||
<div class="mainClass">
|
<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-col :span="7">
|
||||||
|
<el-card class="el-card">
|
||||||
<div class="infinite-list" style="overflow: auto">
|
<div class="infinite-list" style="overflow: auto">
|
||||||
<el-table
|
<el-table
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
|
@ -116,14 +117,16 @@
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
:pager-count="5"
|
:pager-count="5"
|
||||||
:page-sizes="[6, 8, 10, 12, 14]"
|
:page-sizes="[5, 10, 20, 50, 100, 200, 500, 1000]"
|
||||||
small
|
small
|
||||||
layout="total, sizes, prev, pager, next"
|
layout="total, sizes, prev, pager, next"
|
||||||
:total="searchInfo.recordTotal"
|
:total="searchInfo.recordTotal"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="17">
|
<el-col :span="17">
|
||||||
|
<el-card class="el-card">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-row type="flex" justify="center">
|
<el-row type="flex" justify="center">
|
||||||
<el-form-item class="descriptionWide">
|
<el-form-item class="descriptionWide">
|
||||||
|
@ -169,7 +172,7 @@
|
||||||
class="w-full"
|
class="w-full"
|
||||||
:key="currentRecord?.taskID"
|
:key="currentRecord?.taskID"
|
||||||
@stop-reading="search(false)"
|
@stop-reading="search(false)"
|
||||||
:heightDiff="410"
|
:heightDiff="420"
|
||||||
:config="{
|
:config="{
|
||||||
type: 'task',
|
type: 'task',
|
||||||
colorMode: 'task',
|
colorMode: 'task',
|
||||||
|
@ -179,6 +182,7 @@
|
||||||
/>
|
/>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -410,7 +414,7 @@ defineExpose({
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.infinite-list {
|
.infinite-list {
|
||||||
height: calc(100vh - 420px);
|
height: calc(100vh - 320px);
|
||||||
.select-sign {
|
.select-sign {
|
||||||
&::before {
|
&::before {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -449,10 +453,4 @@ defineExpose({
|
||||||
min-width: 1200px;
|
min-width: 1200px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.editor-main {
|
|
||||||
height: calc(100vh - 488px);
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 5px;
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -646,7 +646,7 @@ onBeforeUnmount(() => {
|
||||||
|
|
||||||
.h-systemInfo {
|
.h-systemInfo {
|
||||||
margin-left: 18px;
|
margin-left: 18px;
|
||||||
height: 276px;
|
height: 286px;
|
||||||
}
|
}
|
||||||
@-moz-document url-prefix() {
|
@-moz-document url-prefix() {
|
||||||
.h-systemInfo {
|
.h-systemInfo {
|
||||||
|
|
Loading…
Add table
Reference in a new issue