Cancel doesn't seem to work
svwhisper opened this issue · 2 comments
Input with msg.payload = "cancel" does not seem to have desired behaviour. I have suspended scheduling and have [on] event "manual" and [off] event "duration" of 00:00:07.
When I input "on", the node emits "On", as desired. With no other input, it emits "Off" after 7 seconds, as desired.
I was expecting that "on" followed in one second by "cancel" would not emit "Off" after 7 seconds, but it does.
Even if I do "on" (emits "On") followed immediately by "off" (emits "Off), after 7 seconds I get another "Off" as the timer pops.
So it seems to be that "cancel" has no effect. What might I be doing wrong?
You're not doing anything wrong @svwhisper, how you're expecting it to work is exactly how it should work - it was an error in my code.
I was re-establishing the off event in the cancel
routine, and not clearing the timeout in the off
routine.
Both (I think) are sorted now - are you able to test please?
I'm going to close this - feel free to re-open if you find that it doesn't perform as expected. These fixes will be released to NPM as part of 1.1.8 when testing is complete on a couple of other fixes.