feat: implemented relay controller and use that for fetching and publishing events #149
@ -121,7 +121,7 @@ export class RelayController {
|
|||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
if (!relay.connected) {
|
if (!relay.connected) {
|
||||||
console.log(`${relay.url} : Not connected!`, 'Skipping subscription')
|
console.log(`${relay.url} : Not connected!`, 'Skipping subscription')
|
||||||
return
|
return resolve()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscribe to the relay with the specified filter
|
// Subscribe to the relay with the specified filter
|
||||||
@ -140,6 +140,14 @@ export class RelayController {
|
|||||||
resolve() // Resolve the promise when EOSE is received
|
resolve() // Resolve the promise when EOSE is received
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// add a 30 sec of timeout to subscription
|
||||||
|
setTimeout(() => {
|
||||||
|
if (!sub.closed) {
|
||||||
|
sub.close()
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
}, 30 * 1000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user