优化工作路径拼接方法

This commit is contained in:
lifei6671
2018-07-11 14:18:27 +08:00
parent a5d7be92af
commit 894382dfe0
5 changed files with 39 additions and 16 deletions

View File

@@ -27,7 +27,7 @@ import (
)
var(
exportLimitWorkerChannel = gopool.NewChannelPool(conf.GetExportProcessNum(),conf.GetExportQueueLimitNum())
exportLimitWorkerChannel = gopool.NewChannelPool(conf.GetExportLimitNum(),conf.GetExportQueueLimitNum())
)
type BookResult struct {
@@ -215,14 +215,21 @@ func (m *BookResult) ToBookResult(book Book) *BookResult {
}
//后台转换
func BackgroupConvert(sessionId string,bookResult *BookResult){
func BackgroupConvert(sessionId string,bookResult *BookResult) error {
if err := converter.CheckConvertCommand(); err != nil {
beego.Error("检查转换程序失败 -> ",err)
return err
}
err := exportLimitWorkerChannel.LoadOrStore(bookResult.Identify, func() {
bookResult.Converter(sessionId)
})
if err != nil {
beego.Error("将导出任务加入任务队列失败 -> ",err)
return err
}
exportLimitWorkerChannel.Start()
return nil
}
//导出PDF、word等格式