-
Notifications
You must be signed in to change notification settings - Fork 138
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
EVALG-77 follow up: Change design to use Last-Value Cache and Read #703
base: master
Are you sure you want to change the base?
Conversation
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.
Fix python formatting with black
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.
Suggested several improvements to reduce complexity and improve readability.
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.
Replied to open comments.
Also, make sure to apply relevant feedback to the C++ example as well.
self._metrics_app(), | ||
self._transit_app(), | ||
string += f"[INFO] Vehicle {sample.vehicle_vin}" | ||
if sample.current_route and len(sample.current_route): |
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.
if sample.current_route:
The and is always true.
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.
I don't think this is accurate as if sample.current_route
will evaluate to sample.current_route.__bool__
which tests for whether if the optional is present or not. Once we've checked that, we need to check that the sequence is not empty.
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.
Both None and an empty list/string test to False
:
>>> bool([])
False
>>> bool(None)
False
>>> bool([1])
True
Summary
This PR changes the example to follow a Last-Value Cache pattern on the subscriber. This removes the need for asynchronous code and focuses on polling.
Additionally, a few other changes have been made as left-over TODO from previous PR, #695.
Details and comments
Checks