Keep socket objects around so we can know their quality

This commit is contained in:
Jonathan Staab 2023-08-07 13:49:31 -07:00
parent 66ab182640
commit b9248c1cff
3 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@
- [x] Add log in as user
- [x] Add multi-account support
- [x] Remove authors limit of 256
- [x] Improve relay hints and selection
# 0.3.0

View File

@ -95,7 +95,7 @@ setInterval(() => {
// Prune connections we haven't used in a while
for (const [url, socket] of Network.pool.data.entries()) {
if (socket.meta.last_activity < now() - 60) {
Network.pool.remove(url)
Network.pool.get(url).disconnect()
} else if (userRelays.has(url) && socket.meta.quality < 0.3) {
$slowConnections.push(url)
}

View File

@ -52,7 +52,7 @@ export class Network {
pool = new Pool()
authHandler: (url: string, challenge: string) => void
relayIsLowQuality = (url: string) => this.pool.get(url, {autoConnect: false})?.meta?.quality < 0.5
relayIsLowQuality = (url: string) => this.pool.get(url, {autoConnect: false})?.meta?.quality < 0.6
getExecutor = (urls: string[], {bypassBoot = false} = {}) => {
if (this.engine.Env.FORCE_RELAYS?.length > 0) {