Compare commits
7 commits
c4edcb114d
...
eb0278a82c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb0278a82c | ||
|
|
fe4046a439 | ||
|
|
1f4157b00f | ||
|
|
66b1ceedef | ||
|
|
e6a4994213 | ||
|
|
86baf10041 | ||
|
|
7973fa83cb |
1 changed files with 17 additions and 13 deletions
|
|
@ -205,20 +205,24 @@ export class NostrPool {
|
|||
const log = getLogger({ appName: keys.name })
|
||||
this.log(`📤 Publishing Kind ${event.kind} event to ${relays.length} relay(s): ${relays.join(', ')}`)
|
||||
const pool = new SimplePool()
|
||||
await Promise.all(pool.publish(relays, signed).map(async p => {
|
||||
try {
|
||||
await p
|
||||
sent = true
|
||||
} catch (e: any) {
|
||||
this.log(ERROR, `Failed to publish Kind ${event.kind} event:`, e.message || e)
|
||||
log(e)
|
||||
try {
|
||||
await Promise.all(pool.publish(relays, signed).map(async p => {
|
||||
try {
|
||||
await p
|
||||
sent = true
|
||||
} catch (e: any) {
|
||||
this.log(ERROR, `Failed to publish Kind ${event.kind} event:`, e.message || e)
|
||||
log(e)
|
||||
}
|
||||
}))
|
||||
if (!sent) {
|
||||
this.log(ERROR, `Failed to send Kind ${event.kind} event to any relay`)
|
||||
log("failed to send event")
|
||||
} else {
|
||||
this.log(`✅ Kind ${event.kind} event published successfully (id: ${signed.id.slice(0, 16)}...)`)
|
||||
}
|
||||
}))
|
||||
if (!sent) {
|
||||
this.log(ERROR, `Failed to send Kind ${event.kind} event to any relay`)
|
||||
log("failed to send event")
|
||||
} else {
|
||||
this.log(`✅ Kind ${event.kind} event published successfully (id: ${signed.id.slice(0, 16)}...)`)
|
||||
} finally {
|
||||
pool.close(relays)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue