Skip to content

Commit

Permalink
fix(plc4go/connection-cache): drain lease chan on timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Aug 31, 2022
1 parent a0b7d0b commit e6609cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions plc4go/pkg/api/cache/plc_connection_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ func (t *plcConnectionCache) GetConnection(connectionString string) <-chan plc4g

// Timeout after the maximum waiting time.
case <-maximumWaitTimeout.C:
// In this case we need to drain the chan and return it immediate
go func() {
<-leaseChan
_ = connection.returnConnection(StateIdle)
}()
if t.tracer != nil {
t.tracer.AddTransactionalTrace(txId, "get-connection", "timeout")
}
Expand Down

0 comments on commit e6609cc

Please sign in to comment.