Explorar o código

fix: Adding locking for ThreadPool.State()

Matthias Ladkau %!s(int64=3) %!d(string=hai) anos
pai
achega
71c8b6df3d
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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),