stop fetching early (#539)

* stop fetching early

* Create yellow-pets-invent.md
This commit is contained in:
Felicio Mununga 2024-03-18 23:34:00 +09:00 committed by GitHub
parent 550774e291
commit 6b4e6b1566
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 137 additions and 123 deletions

View File

@ -0,0 +1,5 @@
---
"@status-im/js": patch
---
stop fetching early

View File

@ -159,6 +159,7 @@ class RequestClient {
const symmetricKey = await generateKeyFromPassword(publicKey) const symmetricKey = await generateKeyFromPassword(publicKey)
let communityDescription: CommunityDescription | undefined = undefined let communityDescription: CommunityDescription | undefined = undefined
try {
await this.waku.store.queryWithOrderedCallback( await this.waku.store.queryWithOrderedCallback(
[ [
createDecoder(contentTopic, symmetricKey, { createDecoder(contentTopic, symmetricKey, {
@ -175,7 +176,8 @@ class RequestClient {
} }
if ( if (
message.type !== ApplicationMetadataMessage_Type.COMMUNITY_DESCRIPTION message.type !==
ApplicationMetadataMessage_Type.COMMUNITY_DESCRIPTION
) { ) {
return return
} }
@ -238,9 +240,12 @@ class RequestClient {
} }
// stop // stop
return true throw new Error('stop')
} }
) )
} catch {
// eslint-disable-next-line no-empty
}
return communityDescription return communityDescription
} }
@ -255,6 +260,7 @@ class RequestClient {
let contactCodeAdvertisement: ContactCodeAdvertisement | undefined = let contactCodeAdvertisement: ContactCodeAdvertisement | undefined =
undefined undefined
try {
await this.waku.store.queryWithOrderedCallback( await this.waku.store.queryWithOrderedCallback(
[ [
createDecoder(contentTopic, symmetricKey, { createDecoder(contentTopic, symmetricKey, {
@ -305,9 +311,12 @@ class RequestClient {
} }
// stop // stop
return true throw new Error('stop')
} }
) )
} catch {
// eslint-disable-next-line no-empty
}
return contactCodeAdvertisement return contactCodeAdvertisement
} }