Skip to content

Commit 59c02aa

Browse files
committed
fixing bug, having initial config for in memory cluster runner
1 parent 0a70ba8 commit 59c02aa

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

apps/example-cluster/src/ClusterRunner.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ export class ClusterRunner implements ClusterRunnerInterface {
4848

4949
this.nodeIds = Array.from({ length: nodeCount }, (_, i) => `node${i + 1}`);
5050

51+
this.committedConfig = {
52+
voters: this.nodeIds.map((id, index) => ({ id, address: `localhost:${52000 + index}` })),
53+
learners: []
54+
};
55+
5156
for (const nodeId of this.nodeIds) {
5257
const address = `localhost:${52000 + this.nodeIds.indexOf(nodeId)}`;
5358
const storage = new InMemoryNodeStorage();
@@ -64,11 +69,6 @@ export class ClusterRunner implements ClusterRunnerInterface {
6469
for (const entry of this.entries.values()) {
6570
await entry.node.start();
6671
}
67-
68-
this.committedConfig = {
69-
voters: this.nodeIds.map((id, index) => ({ id, address: `localhost:${52000 + index}` })),
70-
learners: []
71-
};
7272
}
7373

7474
async stop(): Promise<void> {

apps/example-cluster/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ClusterRunnerGRPC } from "./ClusterRunnerGRPC";
44
import { ClusterRunnerInterface } from "./ClusterRunnerInterface";
55
import { WsServer } from "./WsServer";
66

7-
const MODE: "memory" | "grpc" = "grpc";
7+
const MODE: "memory" | "grpc" = "memory";
88

99
const PORT = 4001;
1010
const NODE_COUNT = 3;

0 commit comments

Comments
 (0)