-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: make data retrieval of IOLink sensor more robust #2024
Conversation
collector.collect(parsedEvent); | ||
try { | ||
var portResult = getMap(payload, | ||
"/iolinkmaster/port[%s]/iolinkdevice/pdin".formatted(ports.get(i))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check if the port exists here before fetching it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
try { | ||
var portResult = getMap(payload, | ||
"/iolinkmaster/port[%s]/iolinkdevice/pdin".formatted(ports.get(i))); | ||
var eventData = (String) portResult.get("data"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here for portResult
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Purpose
This PR makes the data retrieval within the IOLink adapter more robust. Prior to it, an error occurring for one port stopped the processing of all subsequent ports. This means, that in case the processing fails for port 2, e.g., since this port is not connected to a sensor and therefore does not deliver any data, parsing for port 3 and 4 is skipped.
From now on, only the affected port will be skipped.
Remarks
PR introduces (a) breaking change(s): no
PR introduces (a) deprecation(s): no