-
Notifications
You must be signed in to change notification settings - Fork 95
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
Clear the queue when consumer reads from it #96
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.
Thank you for your contribution! This looks good to me!
However, I'd like to extend the function's documentation a little. @corycrean would you agree with my suggestion?
Co-authored-by: Felix Exner <[email protected]>
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.
Looks good overall, and I don't see any problems with merging this as I don't think there are any other foreseeable plans to utilize the queued packages in a more useful way.
} | ||
|
||
// If the queue is empty, wait for a package. | ||
return res || queue_.waitDequeTimed(product, timeout); |
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.
Personally not a fan of this type of return structure, but I can accept that as subjective.
Thanks again @corycrean |
Get the latest package each time the consumer reads from the queue.
Currently,
getLatestProduct
callsqueue_.waitDequeTimed
to retrieve a package from the queue, which means that it always retrieves the oldest package from the queue (when the queue contains more than one package). The additional packages remain in the queue, which can cause the queue to fill up over time and lead toPipeline producer overflowed!
errors:Universal_Robots_Client_Library/include/ur_client_library/comm/pipeline.h
Lines 410 to 413 in 8f20b42
This PR modifies
getLatestProduct
so that it always returns the most recent package from the queue, and discards older ones.