Skip to content
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

Add reset feature to batch node #2553

Merged
merged 2 commits into from May 11, 2020

Conversation

HiroyasuNishiyama
Copy link
Member

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

As discussed here, batch node has no way of resetting the internal state.
This PR realizes the means of resetting internal state by an input message.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run grunt to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@coveralls
Copy link

coveralls commented May 5, 2020

Coverage Status

Coverage increased (+0.08%) to 77.539% when pulling ee13cd1 on node-red-hitachi:add-reset-to-batch-node into 417d2cb on node-red:dev.

@@ -204,11 +209,19 @@ module.exports = function(RED) {
var interval = Number(n.interval || "0") *1000;
Copy link
Member

Choose a reason for hiding this comment

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

I realise this isn't related to the PR, but I noticed this line. If n.interval is set to 0 (or undefined) then this will setup an interval of 0ms - which sounds like a bad thing and unlikely to be something a user would actually want.

Should there be a safety check for a minimum interval value and default to a non-0 value to prevent accidentally performing a denial of service of the event loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Added the check of the value of interval.
As additional information, current implementation limits the input value of the interval to be greater than 1, as shown below.

interval: {value:10,validate:function(v) { return RED.validators.number(v) && (v >= 1); }},

@knolleary knolleary merged commit 13932b2 into node-red:dev May 11, 2020
@HiroyasuNishiyama HiroyasuNishiyama deleted the add-reset-to-batch-node branch December 2, 2021 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants