make it possible to track relays on publish.

This commit is contained in:
Asai Toshiya
2024-10-11 01:04:32 +09:00
committed by fiatjaf_
parent 4f6976f6f8
commit 7064e0b828
2 changed files with 41 additions and 1 deletions

View File

@@ -205,7 +205,17 @@ export class AbstractSimplePool {
}
let r = await this.ensureRelay(url)
return r.publish(event)
return r.publish(event).then(reason => {
if (this.trackRelays) {
let set = this.seenOn.get(event.id)
if (!set) {
set = new Set()
this.seenOn.set(event.id, set)
}
set.add(r)
}
return reason
})
})
}