-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
[TRIGGER] Fix ZeroTier Online/Offline Trigger #2804
Comments
@zalmanlew thanks for submitting! The developer who did the original dev work on the other ZeroTier components is out for a bit, but we'll get this added to the queue. |
Just to add more context on the bug. The problem is that a I recommend using the For example: const currentNodeStatus = this.service.db.get(node.id);
if(node.status != currentNodeStatus) {
// emit event
// update db as well:
this.service.db.set(currentNodeStatus);
} Please note, this is pseudocode, but the idea is that we emit events only on node state changes. |
I did several tests and I couldn't replicate this behavior. |
@luancazarine the This means after some period of time it will emit a new event just from the For the purpose of the online/offline trigger, it should only monitor the state of the |
@zalmanlew |
@luancazarine that's because you have your node offline, I guess his is primarily an issue in reverse (as long as your node is online, the If it's going from offline > online then |
@zalmanlew should the trigger ignore this? |
@luancazarine I don't think this should trigger the node online/offline trigger. The only thing that should trigger the event is the state changing of the Example 1 - Online
Example 2 - Offline
Example 3 - Ignore
The easiest way to test this is to leave a node online and running, it will currently keep firing online events, whereas it should only be emitting the online event if the previous state was offline (same goes for offline in vice-versa). |
@luancazarine Can you comment with a link to the PR? Thanks! |
Sorry, I moved the wrong task |
@zalmanlew |
@luancazarine while that is true, I think that's why it depends how frequently you poll the data. It's worth noting that ZeroTier considers the machine |
The current ZeroTier trigger for node online/offline is using the
unique
dedupe parameter.The issue with this is that it checks for unique values across the entire object. If another value like
clock
oripAssignments
change it will trigger the event again.For these two triggers, it needs to be updated to only check if the
online
(boolean) state has changed - and ignore all the other keys.The text was updated successfully, but these errors were encountered: