From 540209eadc556690eb7e3aaa99c3c79d7688c408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 7 Jan 2020 14:20:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index adefdb036..b0775f60b 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -625,9 +625,15 @@ func (v *VendorSync) LoopStoresMap2(ctx *jxcontext.Context, db *dao.DaoDB, taskN taskName = fmt.Sprintf("%s,处理平台%s", taskName, model.VendorChineseNames[loopInfoList[0].VendorID]) } task = tasksch.NewParallelTask(taskName, tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, handler, loopInfoList) - task.SetFinishHook(func(task tasksch.ITask, ctx *jxcontext.Context) { - err = WirteToExcelBySyncFailed(task, ctx) - }) + if isAsync { + task.SetFinishHook(func(task tasksch.ITask, ctx *jxcontext.Context) { + if len(task.GetErrMsg()) > 10 { + err = WirteToExcelBySyncFailed(task, ctx) + } else { + err = errors.New(utils.Format4Output(task.GetErrMsg(), true)) + } + }) + } tasksch.HandleTask(task, nil, isManageIt).Run() if !isAsync { resultList, err2 := task.GetResult(0)