Browse Source

fix: Adding locking for ThreadPool.State()

Matthias Ladkau 3 years ago
parent
commit
71c8b6df3d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      engine/pool/threadpool.go

+ 3 - 0
engine/pool/threadpool.go

@@ -160,6 +160,9 @@ func (tp *ThreadPool) State() map[string]interface{} {
 		return ret
 	}
 
+	tp.workerMapLock.Lock()
+	defer tp.workerMapLock.Unlock()
+
 	return map[string]interface{}{
 		"TaskQueueSize":      tp.queue.Size(),
 		"TotalWorkerThreads": getIdsFromWorkerMap(tp.workerMap),