You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/31 14:02:36 UTC
[plc4x] branch develop updated: fix(plc4go/connection-cache): drain lease chan on timeout
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new e6609cc24 fix(plc4go/connection-cache): drain lease chan on timeout
e6609cc24 is described below
commit e6609cc2424c1a1ff9fec8e5179e0ae81d3d86fb
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Aug 31 16:02:28 2022 +0200
fix(plc4go/connection-cache): drain lease chan on timeout
---
plc4go/pkg/api/cache/plc_connection_cache.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/plc4go/pkg/api/cache/plc_connection_cache.go b/plc4go/pkg/api/cache/plc_connection_cache.go
index 4cdac2077..64c261526 100644
--- a/plc4go/pkg/api/cache/plc_connection_cache.go
+++ b/plc4go/pkg/api/cache/plc_connection_cache.go
@@ -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")
}