Simplify invite timeout handling
This commit is contained in:
@@ -40,17 +40,12 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
try {
|
try {
|
||||||
const [[event]] = await Promise.all([
|
const [[event]] = await Promise.all([
|
||||||
Promise.race([
|
request({
|
||||||
request({
|
relays: [url],
|
||||||
relays: [url],
|
autoClose: true,
|
||||||
autoClose: true,
|
signal: AbortSignal.timeout(10000),
|
||||||
signal: AbortSignal.timeout(10000),
|
filters: [{kinds: [RELAY_INVITE]}],
|
||||||
filters: [{kinds: [RELAY_INVITE]}],
|
}),
|
||||||
}),
|
|
||||||
sleep(10000).then(() => {
|
|
||||||
throw new Error("Invite claim timed out")
|
|
||||||
}),
|
|
||||||
]),
|
|
||||||
sleep(2000),
|
sleep(2000),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user