Throw some errors on invalid relay urls
This commit is contained in:
@@ -119,6 +119,11 @@ export const {
|
|||||||
const relay = stale.get(url)
|
const relay = stale.get(url)
|
||||||
const profile = fresh.get(url)
|
const profile = fresh.get(url)
|
||||||
|
|
||||||
|
if (!url || !isRelayUrl(url)) {
|
||||||
|
console.warn(`Attempted to load invalid relay url: ${url}`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if (profile) {
|
if (profile) {
|
||||||
stale.set(url, {...relay, profile, url})
|
stale.set(url, {...relay, profile, url})
|
||||||
}
|
}
|
||||||
@@ -176,6 +181,11 @@ const updateRelayStats = batch(500, (updates: RelayStatsUpdate[]) => {
|
|||||||
for (const [url, items] of $itemsByUrl.entries()) {
|
for (const [url, items] of $itemsByUrl.entries()) {
|
||||||
const $relay: Relay = $relaysByUrl.get(url) || {url}
|
const $relay: Relay = $relaysByUrl.get(url) || {url}
|
||||||
|
|
||||||
|
if (!url || !isRelayUrl(url)) {
|
||||||
|
console.warn(`Attempted to update stats for an invalid relay url: ${url}`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if (!$relay.stats) {
|
if (!$relay.stats) {
|
||||||
$relay.stats = makeRelayStats()
|
$relay.stats = makeRelayStats()
|
||||||
} else if ($relay.stats.notice_count === undefined) {
|
} else if ($relay.stats.notice_count === undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user