This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 37c4ffd121 fix: Trigger backoff strategy when plc is not connected
(#3930)
37c4ffd121 is described below
commit 37c4ffd1218073646ee3ece1efebb636a613afa1
Author: Philipp Zehnder <[email protected]>
AuthorDate: Fri Nov 14 21:36:46 2025 +0100
fix: Trigger backoff strategy when plc is not connected (#3930)
---
.../connection/ContinuousPlcRequestReader.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git
a/streampipes-extensions/streampipes-connectors-plc/src/main/java/org/apache/streampipes/extensions/connectors/plc/adapter/generic/connection/ContinuousPlcRequestReader.java
b/streampipes-extensions/streampipes-connectors-plc/src/main/java/org/apache/streampipes/extensions/connectors/plc/adapter/generic/connection/ContinuousPlcRequestReader.java
index d8f0e13916..89c302eed7 100644
---
a/streampipes-extensions/streampipes-connectors-plc/src/main/java/org/apache/streampipes/extensions/connectors/plc/adapter/generic/connection/ContinuousPlcRequestReader.java
+++
b/streampipes-extensions/streampipes-connectors-plc/src/main/java/org/apache/streampipes/extensions/connectors/plc/adapter/generic/connection/ContinuousPlcRequestReader.java
@@ -76,18 +76,28 @@ public class ContinuousPlcRequestReader
processPlcReadResponse(readResponse);
} else {
LOG.error("Not connected to PLC with connection string {}",
settings.connectionString());
+ handleFailingPlcRead();
}
} catch (Exception e) {
- handleFailingPlcRead(e.getMessage());
+ handleFailingPlcReadAndRemoveFromCache(e.getMessage());
}
}
- private void handleFailingPlcRead(String problem) {
+ private void handleFailingPlcReadAndRemoveFromCache(String problem) {
// ensure that the cached connection manager removes the broken connection
if (connectionManager instanceof SpCachedPlcConnectionManager) {
((SpCachedPlcConnectionManager)
connectionManager).removeCachedConnection(settings.connectionString());
}
+ LOG.error(
+ "Error while reading from PLC with connection string {}. Setting
adapter to idle for {} attempts. {} ",
+ settings.connectionString(), idlePullsBeforeNextAttempt, problem
+ );
+
+ handleFailingPlcRead();
+ }
+
+ private void handleFailingPlcRead() {
// Increase backoff counter on failure
if (idlePullsBeforeNextAttempt == 0) {
idlePullsBeforeNextAttempt = 1;
@@ -95,11 +105,6 @@ public class ContinuousPlcRequestReader
idlePullsBeforeNextAttempt = Math.min(idlePullsBeforeNextAttempt * 2,
MAX_IDLE_PULLS);
}
- LOG.error(
- "Error while reading from PLC with connection string {}. Setting
adapter to idle for {} attempts. {} ",
- settings.connectionString(), idlePullsBeforeNextAttempt, problem
- );
-
currentIdlePulls = 0;
}