chore: added a timeout of 30 seconds to subscription
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 32s

This commit is contained in:
daniyal 2024-08-19 16:34:42 +05:00
parent 12765cf758
commit 2f1423a35a

View File

@ -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)
}) })
}) })