Skip to content

Commit

Permalink
test(scale): make messages more enriched
Browse files Browse the repository at this point in the history
Add target peer and current time to messages.
  • Loading branch information
mkermani144 committed Apr 15, 2024
1 parent 7b2a730 commit 312e071
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/scaling/src/node/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ const wait = () =>
});

const messages = Array.from({ length: 10 }).map(
(_, index) => `Ping#${index}:${process.env.NODE_PEER_ID!.slice(-5)}`,
(_, index) =>
`Ping@${new Date().toLocaleTimeString([], { hour12: false })}#${index}:${process.env.NODE_PEER_ID!.slice(-5)}`,
);

setInterval(async () => {
for (const message of messages) {
for (const peer of process.env.ALL_PEER_IDS!.split(',')) {
if (peer !== process.env.NODE_PEER_ID!) {
try {
await node.sendMessage(peer, message);
await node.sendMessage(peer, `${message}->${peer.slice(-5)}`);
MessageCounter.increase();
} catch (error) {
console.warn(
Expand Down

0 comments on commit 312e071

Please sign in to comment.