Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Remove DEFAULT_PUBLISH_WINDOW #19

Merged
merged 5 commits into from Dec 2, 2019
Merged

Conversation

mm318
Copy link
Member

@mm318 mm318 commented Dec 2, 2019

Remove the DEFAULT_PUBLISH_WINDOW sentinel value as the publishing period should not be optional anymore.

Copy link
Contributor

@dabonnie dabonnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes for documentation and a minor revert.

@mm318 mm318 changed the title Rename DEFAULT_PUBLISH_WINDOW to INVALID_PUBLISH_WINDOW Remove DEFAULT_PUBLISH_WINDOW Dec 2, 2019
if (!publish_timer_ &&
publish_period_ != PeriodicMeasurementNode::DEFAULT_PUBLISH_WINDOW)
{
if (!publish_timer_ && publish_period_ > std::chrono::milliseconds(0)) {
Copy link
Contributor

@dabonnie dabonnie Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking in the start method is too late: the publish period (and measurement period) should be checked upon construction.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests are currently deliberately passing in invalid publish_periods to avoid this Collector::clearCurrentMeasurements() call.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then why not make zero valid and document as such? We only have an issue if the period is strictly less than zero.

@@ -88,7 +83,7 @@ std::string PeriodicMeasurementNode::getStatusString() const
", measurement_period=" << std::to_string(measurement_period_.count()) << "ms" <<
", publishing_topic=" << publishing_topic_ <<
", publish_period=" <<
(publish_period_ != PeriodicMeasurementNode::DEFAULT_PUBLISH_WINDOW ?
(publish_period_ > std::chrono::milliseconds(0) ?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If done in construction then this is not needed.

@mm318 mm318 merged commit ca97832 into master Dec 2, 2019
@mm318 mm318 deleted the miaofei/rename-default-invalid branch December 2, 2019 22:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants