mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 08:56:29 +00:00
Fix error when closing logs (#2637)
Previously, *all* log streams of the pipeline were closed everytime when a workflow is done, if you have multiple workflows, streams will be closed multiple times. Closes https://github.com/woodpecker-ci/woodpecker/issues/2036
This commit is contained in:
parent
31240b5771
commit
a1a35eb7be
1 changed files with 3 additions and 5 deletions
|
@ -284,13 +284,11 @@ func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
|
||||||
|
|
||||||
// make sure writes to pubsub are non blocking (https://github.com/woodpecker-ci/woodpecker/blob/c919f32e0b6432a95e1a6d3d0ad662f591adf73f/server/logging/log.go#L9)
|
// make sure writes to pubsub are non blocking (https://github.com/woodpecker-ci/woodpecker/blob/c919f32e0b6432a95e1a6d3d0ad662f591adf73f/server/logging/log.go#L9)
|
||||||
go func() {
|
go func() {
|
||||||
for _, wf := range currentPipeline.Workflows {
|
for _, step := range workflow.Children {
|
||||||
for _, step := range wf.Children {
|
|
||||||
if err := s.logger.Close(c, step.ID); err != nil {
|
if err := s.logger.Close(c, step.ID); err != nil {
|
||||||
logger.Error().Err(err).Msgf("done: cannot close log stream for step %d", step.ID)
|
logger.Error().Err(err).Msgf("done: cannot close log stream for step %d", step.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := s.notify(repo, currentPipeline); err != nil {
|
if err := s.notify(repo, currentPipeline); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue