mirror of
https://github.com/stronk-dev/OrchestratorTracker.git
synced 2025-07-05 10:55:09 +02:00
Fix key timeout
This commit is contained in:
parent
d3afd739ae
commit
67781976cc
@ -291,21 +291,33 @@ const onOrchUpdate = async function (id, obj, tag, region, livepeer_regions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove expired stuff
|
// Remove expired stuff
|
||||||
for (const [id, obj] of Object.entries(newInstance.probedFrom)) {
|
Object.keys(newInstance.probedFrom).forEach((key) => {
|
||||||
if (now - obj.lastTime > CONF_KEY_EXPIRY) {
|
if (
|
||||||
newInstance.probedFrom[id] = null;
|
!newInstance.probedFrom[key] ||
|
||||||
|
!newInstance.probedFrom[key].lastTime ||
|
||||||
|
now - newInstance.probedFrom[key].lastTime > CONF_KEY_EXPIRY
|
||||||
|
) {
|
||||||
|
delete newInstance.probedFrom[key];
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
for (const [id, obj] of Object.entries(newInstance.regions)) {
|
Object.keys(newInstance.regions).forEach((key) => {
|
||||||
if (now - obj.lastTime > CONF_KEY_EXPIRY) {
|
if (
|
||||||
newInstance.regions[id] = null;
|
!newInstance.regions[key] ||
|
||||||
|
!newInstance.regions[key].lastTime ||
|
||||||
|
now - newInstance.regions[key].lastTime > CONF_KEY_EXPIRY
|
||||||
|
) {
|
||||||
|
delete newInstance.regions[key];
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
for (const [id, obj] of Object.entries(newInstance.livepeer_regions)) {
|
Object.keys(newInstance.livepeer_regions).forEach((key) => {
|
||||||
if (now - obj.lastTime > CONF_KEY_EXPIRY) {
|
if (
|
||||||
newInstance.livepeer_regions[id] = null;
|
!newInstance.livepeer_regions[key] ||
|
||||||
|
!newInstance.livepeer_regions[key].lastTime ||
|
||||||
|
now - newInstance.livepeer_regions[key].lastTime > CONF_KEY_EXPIRY
|
||||||
|
) {
|
||||||
|
delete newInstance.livepeer_regions[key];
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// Set last times for instance info
|
// Set last times for instance info
|
||||||
newInstance.probedFrom[tag] = {
|
newInstance.probedFrom[tag] = {
|
||||||
@ -436,7 +448,9 @@ const updateScore = async function (address) {
|
|||||||
const newRTR = instance.round_trip_time / instance.seg_duration;
|
const newRTR = instance.round_trip_time / instance.seg_duration;
|
||||||
let latitude = null;
|
let latitude = null;
|
||||||
let longitude = null;
|
let longitude = null;
|
||||||
for (const [resolvedTarget, instance] of Object.entries(thisInstances)) {
|
for (const [resolvedTarget, instance] of Object.entries(
|
||||||
|
thisInstances
|
||||||
|
)) {
|
||||||
if (instance.livepeer_regions[region]) {
|
if (instance.livepeer_regions[region]) {
|
||||||
latitude = instance.latitude;
|
latitude = instance.latitude;
|
||||||
longitude = instance.longitude;
|
longitude = instance.longitude;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user