Log more around usage of waku store

This commit is contained in:
Franck Royer 2021-05-07 10:37:53 +10:00
parent 39a0d38c9e
commit 775a288a5c
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 22 additions and 16 deletions

View File

@ -64,13 +64,12 @@ export default function App() {
{ peerId, protocols }: { peerId: PeerId; protocols: string[] }
) => {
if (protocols.includes(StoreCodec)) {
console.log(
`Retrieving archived messages from ${peerId.toB58String()}`
);
console.log(`${peerId.toB58String()}: retrieving archived messages}`);
try {
const response = await waku.store.queryHistory(peerId, [
ChatContentTopic,
]);
console.log(`${peerId.toB58String()}: messages retrieved:`, response);
if (response) {
const messages = response
.map((wakuMsg) => wakuMsg.payload)
@ -81,6 +80,12 @@ export default function App() {
);
setArchivedMessages(messages);
}
} catch (e) {
console.log(
`${peerId.toB58String()}: error encountered when retrieving archived messages`,
e
);
}
}
};

View File

@ -61,6 +61,7 @@ export class WakuStore {
if (!response.messages || !response.messages.length) {
// No messages left (or stored)
console.log('No messages present in HistoryRPC response');
return messages;
}