mirror of https://github.com/waku-org/js-waku.git
Log more around usage of waku store
This commit is contained in:
parent
39a0d38c9e
commit
775a288a5c
|
@ -64,13 +64,12 @@ export default function App() {
|
||||||
{ peerId, protocols }: { peerId: PeerId; protocols: string[] }
|
{ peerId, protocols }: { peerId: PeerId; protocols: string[] }
|
||||||
) => {
|
) => {
|
||||||
if (protocols.includes(StoreCodec)) {
|
if (protocols.includes(StoreCodec)) {
|
||||||
console.log(
|
console.log(`${peerId.toB58String()}: retrieving archived messages}`);
|
||||||
`Retrieving archived messages from ${peerId.toB58String()}`
|
try {
|
||||||
);
|
|
||||||
const response = await waku.store.queryHistory(peerId, [
|
const response = await waku.store.queryHistory(peerId, [
|
||||||
ChatContentTopic,
|
ChatContentTopic,
|
||||||
]);
|
]);
|
||||||
|
console.log(`${peerId.toB58String()}: messages retrieved:`, response);
|
||||||
if (response) {
|
if (response) {
|
||||||
const messages = response
|
const messages = response
|
||||||
.map((wakuMsg) => wakuMsg.payload)
|
.map((wakuMsg) => wakuMsg.payload)
|
||||||
|
@ -81,6 +80,12 @@ export default function App() {
|
||||||
);
|
);
|
||||||
setArchivedMessages(messages);
|
setArchivedMessages(messages);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(
|
||||||
|
`${peerId.toB58String()}: error encountered when retrieving archived messages`,
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ export class WakuStore {
|
||||||
|
|
||||||
if (!response.messages || !response.messages.length) {
|
if (!response.messages || !response.messages.length) {
|
||||||
// No messages left (or stored)
|
// No messages left (or stored)
|
||||||
|
console.log('No messages present in HistoryRPC response');
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue