Skip to content

Commit

Permalink
doc: record time diff between expected and actual delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
cknight committed Sep 14, 2023
1 parent d935568 commit c8c147a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ async function enqueue(msg: number, delay: number): Promise<void> {
* msg is the unix timestamp of the expected delivery date/time of the message
*/
kv.listenQueue(async (msg: unknown) => {
console.log(
`Received message: ${msg} (${new Date(msg as number).toUTCString()})`,
);

const now = Date.now();
const msgTime = Number(msg);

console.log(
`Received message: ${msg} (${new Date(msg as number).toUTCString()}), time diff of ${now - msgTime}ms`,
);

// Set stats of delivery accuracy for UI display purposes
await kv.set(
LAST_MESSAGE_DELIVERY_KEY,
Expand Down

0 comments on commit c8c147a

Please sign in to comment.