Compare commits
2 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
ae41655c5d | |
|
|
9cf8777a16 |
|
|
@ -11,11 +11,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitea.cdlsxd.cn/self-tools/l-export-async/attachment"
|
|
||||||
"gitea.cdlsxd.cn/self-tools/l-export-async/coroutine"
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"golang.org/x/sync/errgroup"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -23,6 +18,12 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"gitea.cdlsxd.cn/self-tools/l-export-async/attachment"
|
||||||
|
"gitea.cdlsxd.cn/self-tools/l-export-async/coroutine"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"golang.org/x/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exportAsyncPool = &sync.Pool{
|
var exportAsyncPool = &sync.Pool{
|
||||||
|
|
@ -142,9 +143,11 @@ func (e *ExportAsync) Run(ctx context.Context) (task_id string, cacheDir string,
|
||||||
e.logTool.Errorf("导出panic:\n任务:%s,错误原因:%s", e.task.Id, _err)
|
e.logTool.Errorf("导出panic:\n任务:%s,错误原因:%s", e.task.Id, _err)
|
||||||
}
|
}
|
||||||
e.release()
|
e.release()
|
||||||
|
if e.uploader != nil {
|
||||||
if e.uploader.Host != "" {
|
if e.uploader.Host != "" {
|
||||||
os.RemoveAll(tempDir)
|
os.RemoveAll(tempDir)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cancel()
|
cancel()
|
||||||
}()
|
}()
|
||||||
|
|
@ -189,7 +192,7 @@ func (e *ExportAsync) export(ctx context.Context, tempDir string) (source string
|
||||||
if err = e.folderToZip(excelsDir, source); err != nil {
|
if err = e.folderToZip(excelsDir, source); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if e.uploader != nil {
|
||||||
if len(e.uploader.Host) > 0 {
|
if len(e.uploader.Host) > 0 {
|
||||||
e.logTool.Infof("异步导出任务:%s,开始上传", e.task.Id)
|
e.logTool.Infof("异步导出任务:%s,开始上传", e.task.Id)
|
||||||
source, err = e.upload(source)
|
source, err = e.upload(source)
|
||||||
|
|
@ -197,6 +200,8 @@ func (e *ExportAsync) export(ctx context.Context, tempDir string) (source string
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e.task.Source = source
|
e.task.Source = source
|
||||||
e.processAdd(ctx, ATT.int())
|
e.processAdd(ctx, ATT.int())
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue