This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch rel/0.98.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 9641edb90968c5597de789930c219305d552bf0c
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;
   }
 

Reply via email to