marion 5 tahun lalu
induk
melakukan
c275be536a
1 mengubah file dengan 3 tambahan dan 3 penghapusan
  1. 3 3
      utils/queue/chan_pool.go

+ 3 - 3
utils/queue/chan_pool.go

@@ -33,11 +33,11 @@ func NewChanWorker(workerId, capacity int, workerPool chan chan interface{}) *Ch
 
 func (w *ChanWorker) Start(callback func(workerId int, msg interface{})) {
 	go func(w *ChanWorker, callback func(workerId int, msg interface{})) {
-		// 新工作管道加入工作管道池
-		w.WorkerPool <- w.JobChannel
-
 		defer utils.DefaultGoroutineRecover(nil, `chan池工作对象消息处理`)
 		for {
+			// 新工作管道加入工作管道池
+			w.WorkerPool <- w.JobChannel
+
 			select {
 			case msg, ok := <-w.JobChannel:
 				if ok {