Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Dec 25, 2024
1 parent 24af37e commit 0293898
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/programs/data/shared-log/test/sharding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
checkBounded,
checkIfSetupIsUsed,
dbgLogs,
slowDownSend,
waitForConverged,
} from "./utils.js";
import { EventStore } from "./utils/stores/event-store.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/programs/data/shared-log/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export const collectMessagesFn = (log: SharedLog<any, any>) => {
export const slowDownSend = (
from: ProgramClient,
to: ProgramClient,
ms = 3000,
ms: number | (() => number) = 3000,
) => {
const directsub = from.services.pubsub as DirectSub;
for (const [_key, peer] of directsub.peers) {
if (peer.publicKey.equals(to.identity.publicKey)) {
const writeFn = peer.write.bind(peer);
peer.write = async (msg, priority) => {
await delay(ms);
await delay(typeof ms === "number" ? ms : ms());
if (peer.outboundStream) {
return writeFn(msg, priority);
}
Expand Down

0 comments on commit 0293898

Please sign in to comment.