Skip to content

Commit

Permalink
Fix error when closing logs (woodpecker-ci#2637)
Browse files Browse the repository at this point in the history
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 woodpecker-ci#2036
  • Loading branch information
qwerty287 committed Oct 24, 2023
1 parent 948a5b3 commit 5497b15
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server/grpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,9 @@ 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)
go func() {
for _, wf := range currentPipeline.Workflows {
for _, step := range wf.Children {
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)
}
for _, step := range workflow.Children {
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)
}
}
}()
Expand Down

0 comments on commit 5497b15

Please sign in to comment.