Skip to content

Commit

Permalink
optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
dobyte committed Oct 17, 2023
1 parent 261530a commit 2619272
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (l *defaultLogger) print(level Level, isNeedStack bool, a ...interface{}) {

// Print 打印日志
func (l *defaultLogger) Print(level Level, a ...interface{}) {
l.entityPool.build(level, false, a...).Log()
l.print(level, false, a...)
}

// Printf 打印模板日志
Expand Down
5 changes: 3 additions & 2 deletions task/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package task

import (
"github.com/dobyte/due/v2/log"
"github.com/dobyte/due/v2/utils/xcall"
"github.com/panjf2000/ants/v2"
)

Expand Down Expand Up @@ -64,13 +65,13 @@ func GetPool() Pool {
// AddTask 添加任务
func AddTask(task func()) {
if globalPool == nil {
go task()
go xcall.Call(task)
return
}

err := globalPool.AddTask(task)
if err != nil {
go task()
go xcall.Call(task)
log.Warnf("add task to the task pool failed: %v", err)
return
}
Expand Down

0 comments on commit 2619272

Please sign in to comment.