Throw some errors on invalid relay urls

This commit is contained in:
Jon Staab
2025-08-26 11:01:31 -07:00
parent 24ed236a46
commit e7a0add8cc
+10
View File
@@ -119,6 +119,11 @@ export const {
const relay = stale.get(url)
const profile = fresh.get(url)
if (!url || !isRelayUrl(url)) {
console.warn(`Attempted to load invalid relay url: ${url}`)
continue
}
if (profile) {
stale.set(url, {...relay, profile, url})
}
@@ -176,6 +181,11 @@ const updateRelayStats = batch(500, (updates: RelayStatsUpdate[]) => {
for (const [url, items] of $itemsByUrl.entries()) {
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) {
$relay.stats = makeRelayStats()
} else if ($relay.stats.notice_count === undefined) {