Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
135 stars 2 forks source link

Better LNL Bridge selection method #2984

Open ProbablePrime opened 2 weeks ago

ProbablePrime commented 2 weeks ago

Is your feature request related to a problem? Please describe.

Currently, the LNL Bridge that Resonite uses is determined by which compatible bridge has the newest "timestamp" value from https://api.resonite.com/networkNodes

For example in this abbreviated api response:

"timestamp": "2024-09-19T22:19:28.5457312+00:00",
"name": "resonite-bridge-aus-1",
....
"timestamp": "2024-09-19T22:19:14.1119735+00:00",
"name": "resonite-bridge-eu-1",

Aus, will always be picked over EU, This is because its update cycle(when it reports back to the api), is slightly offset from Aus based on when it was restarted.

Timestamp is therefore not a good measure for the best Bridge, AUS might have the worst network performance but the fastest update and lead to it being picked all the time.

Describe the solution you'd like

I'd like the bridge selection to be based on ping like the Relays

Describe alternatives you've considered

At this point, there's really only one alternative which is that the server which is that each time the nodes are restarted, one node will end up "winning" based on restart time when the Updating loop starts.

Additional Context

No response

Requesters

Me

ProbablePrime commented 1 week ago

As it turns out, each bridge node didn't have NTP enabled. This made Australia win as it was a minute or so in the future. I've enabled NTP on all the machines and re-synced the time.

I have also added a randomized 0-500 ms offset to the value reported on some of the nodes, this is temporary until I have time to update the client which will take a little longer as It needs to be done correctly.

Anyway, with all of that done, you can see how things are a little more balanced now.

image

When I get a chance, I also want to do the same treatment to the Asset Worker which should stop that from periodically appearing in ⁠alerts .