This commit is contained in:
苏尹岚
2021-04-06 14:09:33 +08:00
parent 950ca404eb
commit 0ddc5efa12
5 changed files with 14 additions and 12 deletions

View File

@@ -6,13 +6,14 @@ import (
"fmt"
"runtime/debug"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/utils"
)
const (
chanPoolSize = 8
chanPoolSize = 20
)
type TaskParam struct {
@@ -61,7 +62,7 @@ func callHandler(handler func()) (retVal interface{}) {
func taskFun(taskChan chan *TaskParam, index int) {
for {
taskParam := <-taskChan
// baseapi.SugarLogger.Debugf("routine:%d, handle task:%v", index, taskParam.handler)
baseapi.SugarLogger.Debugf("routine:%d, handle task:%v", index, taskParam.handler)
result := callHandler(taskParam.handler)
if taskParam.resultChan != nil {
taskParam.resultChan <- result