优化异步导出,修复上传空指针判断
This commit is contained in:
parent
b262190ca1
commit
9cf8777a16
|
|
@ -11,11 +11,6 @@ import (
|
|||
"strconv"
|
||||
"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"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -23,6 +18,12 @@ import (
|
|||
"sync"
|
||||
"sync/atomic"
|
||||
"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{
|
||||
|
|
@ -189,14 +190,16 @@ func (e *ExportAsync) export(ctx context.Context, tempDir string) (source string
|
|||
if err = e.folderToZip(excelsDir, source); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(e.uploader.Host) > 0 {
|
||||
e.logTool.Infof("异步导出任务:%s,开始上传", e.task.Id)
|
||||
source, err = e.upload(source)
|
||||
if err != nil {
|
||||
return
|
||||
if e.uploader != nil {
|
||||
if len(e.uploader.Host) > 0 {
|
||||
e.logTool.Infof("异步导出任务:%s,开始上传", e.task.Id)
|
||||
source, err = e.upload(source)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
e.task.Source = source
|
||||
e.processAdd(ctx, ATT.int())
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue