Skip to content

Commit

Permalink
add DefaultQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
lixizan committed Mar 24, 2023
1 parent f25a6a9 commit 39b33fd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions worker_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"time"
)

type (
WorkerQueue struct {
mu *sync.Mutex // 锁
q []Job // 任务队列
maxConcurrency int64 // 最大并发
curConcurrency int64 // 当前并发
OnRecovery func(exception interface{}) // 异常处理
}
)
var DefaultQueue = NewWorkerQueue().SetConcurrency(64)

type WorkerQueue struct {
mu *sync.Mutex //
q []Job // 任务队列
maxConcurrency int64 // 最大并发
curConcurrency int64 // 当前并发
OnRecovery func(exception interface{}) // 异常处理
}

// NewWorkerQueue 创建一个任务队列
func NewWorkerQueue() *WorkerQueue {
Expand Down

0 comments on commit 39b33fd

Please sign in to comment.