Skip to content

Commit

Permalink
fix(plc4go/spi): fix concurrency issue in DefaultCodec
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Apr 18, 2023
1 parent 189b0fc commit 0cbf147
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plc4go/spi/default/DefaultCodec.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,18 @@ func (m *defaultCodec) TimeoutExpectations(now time.Time) {
// Remove this expectation from the list.
m.expectations = append(m.expectations[:index], m.expectations[index+1:]...)
// Call the error handler.
go func() {
go func(expectation spi.Expectation) {
if err := expectation.GetHandleError()(plcerrors.NewTimeoutError(now.Sub(expectation.GetExpiration()))); err != nil {
log.Error().Err(err).Msg("Got an error handling error on expectation")
}
}()
}(expectation)
}
if err := expectation.GetContext().Err(); err != nil {
go func() {
go func(expectation spi.Expectation) {
if err := expectation.GetHandleError()(err); err != nil {
log.Error().Err(err).Msg("Got an error handling error on expectation")
}
}()
}(expectation)
}
}
}
Expand Down

0 comments on commit 0cbf147

Please sign in to comment.