Skip to content

Commit

Permalink
Merge pull request #15 from waku-org/weboko/follow-up
Browse files Browse the repository at this point in the history
fix: increase interval, add minor fixes
  • Loading branch information
weboko authored Nov 29, 2023
2 parents 9112bd2 + 1000d45 commit daca898
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
9 changes: 6 additions & 3 deletions src/services/rln.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/waku.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Relay {

this.subscriptionRoutine = window.setInterval(async () => {
await this.fetchMessages();
}, SECOND);
}, 10 * SECOND);

this.contentTopicListeners.set(contentTopic, 1);
} catch (error) {
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/utils/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
Expand All @@ -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)
});
Expand Down

0 comments on commit daca898

Please sign in to comment.