So I'm pretty happy with my first node project (a fork of a node to produce my Life360 node), but there's a minor issue that I'm rather stumped how to solve. It is described at length here:
but in short:
- User installs package containing 2 nodes (Life360 and Life360-Server)
- User adds a Life360 node to a flow and edits it...
- Clicks the pencil button and enters their login info for the server
- Deploys (default)
When deploying a Life360 node on a flow, a callback is added to the server (config) node's associative array for callbacks.
When deployed, the server polls every 15 seconds for updates and cycles through the callback array to send updates to every Life360 node in the flows.
If there are no enabled Life360 nodes on any flows, a log message is spit out "No callbacks" to tell the user that the server is running but nothing is listening (I.e. wastes cycles).
Everything works as expected except after the install and until the next restart of node red. The Life360 nodes get all their updates, but the server node also spits out the no callbacks message. After a restart of node red, the message goes away and everything from then on seems to work as intended.
I'm stumped as to how the no callbacks message is being spit out. It makes no sense. As long as there is at least 1 Life360 node on any flow, the message should not be spit out.
The sendChanged method loops through all the callbacks to send the message and if at least one is not disabled, a Boolean is set to not generate the message.
The only thing I can figure is that there must exist some phantom copy of the config node that is complaining... and that the working one is quietly operating as expected.
I've looked at the code a few times but I haven't started debugging and I'm wondering what direction to go. Is my hunch of a phantom copy of the config node an actual possibility?