
Call node events globally
Leon-JavaScript opened this issue ยท 2 comments
Description
Currently the following events are only emitted on the server the change occured on:
In a network setup this causes the following scenarios:
- When adding/removing a node to a user through the backend server the events will only be emitted on the backend server.
- When a node expires the events are called on the backend servers and the proxy.
This makes it extremely difficult to run a piece of code only once in a global context if one of these events happens.
Proposed Behaviour
The events should be called globally, so if you add a node to a user via the backend server, the proxy should also emit a NodeMutateEvent (and also the other Node events if they fit into the change)
Extra Details
An example for what this change can be useful: A group history tracking with timestamps can be made only on the proxy, currently this is not possible and the fact that an expiring node calls the event on all servers makes it extremely difficult to track if a change has already been processed or not.
What is the actual end-goal that you're trying to accomplish? LP has a lot of ways to interact with data, and while this suggestion may seem like the best bet, there's likely already a way to do what you want to do in a straightforward way. Any more detail on your setup and end-goal would be much appreciated!
The thing I tried to do was a tracker for how long a player had a specific group. And the thing that is holding me back is that these node events are called weirdly, as currently, if:
- You run
/lp user jeb_ parent addtemp somegroup 1d
- only the backend server calls theNodeAddEvent
(same with remove) - You run
/lpv user jeb_ parent addtemp somegroup 1d
- all servers call theNodeAddEvent
(same with remove) - The group expires naturally - all servers run the
NodeRemoveEvent
.
- Relying on the sync events doesn't seem that right, as they give no information about what actually changed, like the node events do.
- And only relying on the velocity commands to trigger the events is also not good, as if only one person executes such a command via the backend server, the data is inconsistent.
So it would be nice if, regardless of where the command gets executed, the events get called.