Make sure step passed into go routine exist and does not change (#1903)

just a tiny code improvement
This commit is contained in:
6543 2023-07-06 20:19:10 +02:00 committed by GitHub
parent 5d72060bbd
commit 94f2331a4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,15 +48,16 @@ func start(ctx context.Context, store store.Store, activePipeline *model.Pipelin
}
// open logs streamer for each step
go func() {
for _, wf := range activePipeline.Workflows {
for _, step := range wf.Children {
if err := server.Config.Services.Logs.Open(context.Background(), step.ID); err != nil {
log.Error().Err(err).Msgf("could not open log stream for step %d", step.ID)
for _, wf := range activePipeline.Workflows {
for _, step := range wf.Children {
stepID := step.ID
go func() {
if err := server.Config.Services.Logs.Open(context.Background(), stepID); err != nil {
log.Error().Err(err).Msgf("could not open log stream for step %d", stepID)
}
}
}()
}
}()
}
updatePipelineStatus(ctx, activePipeline, repo, user)