Merge pull request #15 from waku-org/weboko/follow-up

fix: increase interval, add minor fixes
This commit is contained in:
Sasha 2023-11-29 12:00:45 +01:00 committed by GitHub
commit daca898ba9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 11 deletions

View File

@ -109,9 +109,12 @@ export class RLN implements IRLN {
private initKeystore(): Keystore {
const localKeystoreString = localStorage.getItem("keystore");
const _keystore = Keystore.fromString(localKeystoreString || "");
return _keystore || Keystore.create();
try {
return Keystore.fromString(localKeystoreString || "");
} catch(error) {
return Keystore.create();
}
}
public addEventListener(name: RLNEventsNames, fn: EventListener) {

View File

@ -53,7 +53,7 @@ class Relay {
this.subscriptionRoutine = window.setInterval(async () => {
await this.fetchMessages();
}, SECOND);
}, 10 * SECOND);
this.contentTopicListeners.set(contentTopic, 1);
} catch (error) {
@ -84,7 +84,7 @@ class Relay {
}
private async fetchMessages(): Promise<void> {
const contentTopic = Object.keys(this.contentTopicListeners)[0];
const contentTopic = Array.from(this.contentTopicListeners.keys())[0];
if (!contentTopic) {
return;

View File

@ -5,9 +5,7 @@ export const http = {
mode: "no-cors",
referrerPolicy: "no-referrer",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
"Access-Control-Allow-Origin": "*",
'Content-Type': 'text/plain',
},
body: JSON.stringify(body)
});
@ -18,9 +16,7 @@ export const http = {
mode: "no-cors",
referrerPolicy: "no-referrer",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
"Access-Control-Allow-Origin": "*",
'Content-Type': 'text/plain',
},
body: JSON.stringify(body)
});