mirror of
https://github.com/stronk-dev/OrchestratorTracker.git
synced 2025-07-05 02:45:10 +02:00
more fixes
This commit is contained in:
parent
df401322fc
commit
b2ae0eeee5
@ -1,6 +1,6 @@
|
|||||||
const express = require("express");
|
const express = require("express");
|
||||||
const client = require("prom-client");
|
const client = require("prom-client");
|
||||||
const { JsonRpcProvider } = require("ethers");
|
const { ethers } = require("ethers");
|
||||||
const {
|
const {
|
||||||
CONF_API_L1_HTTP,
|
CONF_API_L1_HTTP,
|
||||||
CONF_API_L1_KEY,
|
CONF_API_L1_KEY,
|
||||||
@ -17,7 +17,7 @@ const {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const l1provider = new JsonRpcProvider(CONF_API_L1_HTTP + CONF_API_L1_KEY);
|
const l1provider = new ethers.JsonRpcProvider(CONF_API_L1_HTTP + CONF_API_L1_KEY);
|
||||||
const masterRouter = express.Router();
|
const masterRouter = express.Router();
|
||||||
const register = new client.Registry();
|
const register = new client.Registry();
|
||||||
|
|
||||||
@ -100,7 +100,8 @@ const getEnsDomain = async function (addr) {
|
|||||||
return cached.domain ? cached.domain : cached.address;
|
return cached.domain ? cached.domain : cached.address;
|
||||||
}
|
}
|
||||||
// Refresh cause not cached or stale
|
// Refresh cause not cached or stale
|
||||||
const ensDomain = await l1provider.lookupAddress(addr.toLowerCase());
|
const address = ethers.getAddress(addr);
|
||||||
|
const ensDomain = await l1provider.lookupAddress(address);
|
||||||
let ensObj;
|
let ensObj;
|
||||||
if (!ensDomain) {
|
if (!ensDomain) {
|
||||||
ensObj = {
|
ensObj = {
|
||||||
@ -126,6 +127,7 @@ const getEnsDomain = async function (addr) {
|
|||||||
ensDomainCache[addr] = ensObj;
|
ensDomainCache[addr] = ensObj;
|
||||||
return ensObj.domain ? ensObj.domain : ensObj.address;
|
return ensObj.domain ? ensObj.domain : ensObj.address;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
console.log("Error looking up ENS info, retrying...");
|
console.log("Error looking up ENS info, retrying...");
|
||||||
await sleep(50);
|
await sleep(50);
|
||||||
return null;
|
return null;
|
||||||
@ -416,7 +418,7 @@ const updateScore = async function (address) {
|
|||||||
const newSR = instance.round_trip_time / instance.seg_duration;
|
const newSR = instance.round_trip_time / instance.seg_duration;
|
||||||
let latitude = null;
|
let latitude = null;
|
||||||
let longitude = null;
|
let longitude = null;
|
||||||
for (const instance of orchCache[address].instances) {
|
for (const [resolvedTarget, instance] of orchCache[address].instances) {
|
||||||
if (instance.livepeer_regions[region]) {
|
if (instance.livepeer_regions[region]) {
|
||||||
latitude = instance.livepeer_regions[region].latitude;
|
latitude = instance.livepeer_regions[region].latitude;
|
||||||
longitude = instance.livepeer_regions[region].longitude;
|
longitude = instance.livepeer_regions[region].longitude;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user