Fix race condition

This commit is contained in:
Dane Everitt 2021-01-25 20:29:34 -08:00
parent f3a6ee7a45
commit 31757a68a9
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -60,6 +60,7 @@ func (m *Manager) initializeFromRemoteSource(ctx context.Context, client remote.
pool := workerpool.New(runtime.NumCPU()) pool := workerpool.New(runtime.NumCPU())
log.Debugf("using %d workerpools to instantiate server instances", runtime.NumCPU()) log.Debugf("using %d workerpools to instantiate server instances", runtime.NumCPU())
for _, data := range servers { for _, data := range servers {
data := data
pool.Submit(func() { pool.Submit(func() {
// Parse the json.RawMessage into an expected struct value. We do this here so that a single broken // Parse the json.RawMessage into an expected struct value. We do this here so that a single broken
// server does not cause the entire boot process to hang, and allows us to show more useful error // server does not cause the entire boot process to hang, and allows us to show more useful error