Compare commits
6 Commits
8b4f1a8973
...
5a2a0ad9c4
Author | SHA1 | Date | |
---|---|---|---|
5a2a0ad9c4 | |||
bf1b3beb63 | |||
32a6f9d7a3 | |||
5f0234a358 | |||
235e76be4e | |||
09229f42c7 |
@ -109,6 +109,7 @@ export const MainLayout = () => {
|
|||||||
|
|
||||||
if (pubkey && !hasSubscribed.current) {
|
if (pubkey && !hasSubscribed.current) {
|
||||||
// Call `subscribeForSigits` only if it hasn't been called before
|
// Call `subscribeForSigits` only if it hasn't been called before
|
||||||
|
// #193 disabled websocket subscribtion, until #194 is done
|
||||||
subscribeForSigits(pubkey)
|
subscribeForSigits(pubkey)
|
||||||
|
|
||||||
// Mark `subscribeForSigits` as called
|
// Mark `subscribeForSigits` as called
|
||||||
|
@ -859,9 +859,16 @@ export const subscribeForSigits = async (pubkey: string) => {
|
|||||||
'#p': [pubkey]
|
'#p': [pubkey]
|
||||||
}
|
}
|
||||||
|
|
||||||
relayController.subscribeForEvents(filter, relaySet.read, (event) => {
|
// Process the received event synchronously
|
||||||
processReceivedEvent(event) // Process the received event
|
const events = await relayController.fetchEvents(filter, relaySet.read)
|
||||||
})
|
for (const e of events) {
|
||||||
|
await processReceivedEvent(e)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Async processing of the events has a race condition
|
||||||
|
// relayController.subscribeForEvents(filter, relaySet.read, (event) => {
|
||||||
|
// processReceivedEvent(event)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
const processReceivedEvent = async (event: Event, difficulty: number = 5) => {
|
const processReceivedEvent = async (event: Event, difficulty: number = 5) => {
|
||||||
@ -907,7 +914,7 @@ const processReceivedEvent = async (event: Event, difficulty: number = 5) => {
|
|||||||
|
|
||||||
if (!meta) return
|
if (!meta) return
|
||||||
|
|
||||||
updateUsersAppData(meta)
|
await updateUsersAppData(meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user