chore(buddybook): fix telemetry timestamp inconsistency
This commit is contained in:
parent
7c5cfcdbf4
commit
a65d7218ae
|
@ -71,7 +71,7 @@ export function createMessage({
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function* getMessagesFromStore(node: LightNode) {
|
export async function* getMessagesFromStore(node: LightNode) {
|
||||||
const startTime = performance.now();
|
const startTime = Math.ceil(Date.now() / 1000);
|
||||||
try {
|
try {
|
||||||
for await (const messagePromises of node.store.queryGenerator([decoder])) {
|
for await (const messagePromises of node.store.queryGenerator([decoder])) {
|
||||||
const messages = await Promise.all(messagePromises);
|
const messages = await Promise.all(messagePromises);
|
||||||
|
@ -83,7 +83,7 @@ export async function* getMessagesFromStore(node: LightNode) {
|
||||||
yield blockPayload;
|
yield blockPayload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const endTime = performance.now();
|
const endTime = Math.ceil(Date.now() / 1000);
|
||||||
const timeTaken = endTime - startTime;
|
const timeTaken = endTime - startTime;
|
||||||
console.log("getMessagesFromStore", timeTaken)
|
console.log("getMessagesFromStore", timeTaken)
|
||||||
|
|
||||||
|
@ -94,14 +94,14 @@ export async function* getMessagesFromStore(node: LightNode) {
|
||||||
timeTaken,
|
timeTaken,
|
||||||
}));
|
}));
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
const endTime = performance.now();
|
const endTime = Math.ceil(Date.now() / 1000);
|
||||||
const timeTaken = endTime - startTime;
|
const timeTaken = endTime - startTime;
|
||||||
Telemetry.push([{
|
Telemetry.push([{
|
||||||
type: TelemetryType.LIGHT_PUSH_FILTER,
|
type: TelemetryType.LIGHT_PUSH_FILTER,
|
||||||
protocol: "lightPush",
|
protocol: "lightPush",
|
||||||
timestamp: toInt(startTime),
|
timestamp: startTime,
|
||||||
createdAt: toInt(startTime),
|
createdAt: startTime,
|
||||||
seenTimestamp: toInt(startTime),
|
seenTimestamp: startTime,
|
||||||
peerId: node.peerId.toString(),
|
peerId: node.peerId.toString(),
|
||||||
contentTopic: encoder.contentTopic,
|
contentTopic: encoder.contentTopic,
|
||||||
pubsubTopic: encoder.pubsubTopic,
|
pubsubTopic: encoder.pubsubTopic,
|
||||||
|
@ -128,7 +128,7 @@ export async function subscribeToFilter(node: LightNode, callback: (message: Blo
|
||||||
result,
|
result,
|
||||||
node,
|
node,
|
||||||
decoder,
|
decoder,
|
||||||
timestamp: Date.now(),
|
timestamp: Math.ceil(Date.now() / 1000),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const {error, subscription, results} = result;
|
const {error, subscription, results} = result;
|
||||||
|
|
Loading…
Reference in New Issue