Skip to content

Commit d9e7df2

Browse files
committed
Temporarily turn on device sync and multiple client instances
1 parent 822709e commit d9e7df2

File tree

4 files changed

+81
-62
lines changed

4 files changed

+81
-62
lines changed

forks/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export const workerNames = [
1212
"random3",
1313
"random4",
1414
"random5",
15+
"random1",
16+
"random2",
17+
"random3",
18+
"random4",
19+
"random5",
1520
] as string[];
1621

1722
// Operations configuration - enable/disable specific operations

helpers/versions.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ export const regressionClient = async (
275275
loggingLevel,
276276
apiUrl,
277277
appVersion: APP_VERSION,
278+
historySyncUrl: "http://localhost:5558",
279+
disableDeviceSync: false,
278280
codecs: [new ReactionCodec(), new ReplyCodec()],
279281
});
280282
} catch (error) {

multinode/docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ services:
117117
image: ghcr.io/xmtp/mls-validation-service:main
118118
platform: linux/amd64
119119

120+
history-server:
121+
image: ghcr.io/xmtp/message-history-server:main
122+
platform: linux/amd64
123+
ports:
124+
- 5558:5558
125+
120126
db:
121127
image: postgres:13
122128
environment:

workers/manager.ts

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ export async function getWorkers(
516516
(v) => v.nodeBindings,
517517
);
518518
}
519-
let workerPromises: Promise<Worker>[] = [];
519+
let successfulResults: Worker[] = [];
520520
let descriptors: string[] = [];
521521

522522
// Handle different input types
@@ -528,68 +528,75 @@ export async function getWorkers(
528528
: getFixedNames(workers)
529529
: workers;
530530
descriptors = names;
531-
workerPromises = descriptors.map((descriptor) =>
532-
manager.createWorker(
533-
descriptor,
534-
sdkVersions[Math.floor(Math.random() * sdkVersions.length)],
535-
),
536-
);
531+
for (const descriptor of descriptors) {
532+
successfulResults.push(
533+
await manager.createWorker(
534+
descriptor,
535+
sdkVersions[Math.floor(Math.random() * sdkVersions.length)],
536+
),
537+
);
538+
}
537539
} else {
538540
// Record input - apply versioning if requested
539541
let entries = Object.entries(workers);
540542

541543
descriptors = entries.map(([descriptor]) => descriptor);
542-
workerPromises = entries.map(([descriptor, apiUrl]) =>
543-
manager.createWorker(descriptor, sdkVersions[0], apiUrl),
544-
);
545-
}
546-
547-
// Only use progress bar if there are more than 50 workers
548-
const useProgressBar = workerPromises.length > 50;
549-
let progressBar: ProgressBar | undefined;
550-
551-
if (useProgressBar) {
552-
progressBar = new ProgressBar(
553-
workerPromises.length,
554-
`Initializing ${workerPromises.length} workers...`,
555-
);
556-
// Show initial progress immediately
557-
progressBar.update(0);
558-
}
559-
560-
// Track all workers in parallel and update progress as each completes
561-
let completedCount = 0;
562-
const results = await Promise.allSettled(
563-
workerPromises.map(async (workerPromise) => {
564-
try {
565-
const worker = await workerPromise;
566-
completedCount++;
567-
if (useProgressBar && progressBar) {
568-
progressBar.update(completedCount);
569-
}
570-
return worker;
571-
} catch (error) {
572-
completedCount++;
573-
if (useProgressBar && progressBar) {
574-
progressBar.update(completedCount);
575-
}
576-
throw error;
577-
}
578-
}),
579-
);
580-
581-
// Check for any failures
582-
const failedResults = results.filter(
583-
(result) => result.status === "rejected",
584-
);
585-
if (failedResults.length > 0) {
586-
throw failedResults[0].reason;
544+
for (const descriptor of descriptors) {
545+
successfulResults.push(
546+
await manager.createWorker(
547+
descriptor,
548+
sdkVersions[Math.floor(Math.random() * sdkVersions.length)],
549+
),
550+
);
551+
}
587552
}
588553

589-
// Extract successful results
590-
const successfulResults = results.map(
591-
(result) => (result as PromiseFulfilledResult<Worker>).value,
592-
);
554+
// // Only use progress bar if there are more than 50 workers
555+
// const useProgressBar = workerPromises.length > 50;
556+
// let progressBar: ProgressBar | undefined;
557+
558+
// if (useProgressBar) {
559+
// progressBar = new ProgressBar(
560+
// workerPromises.length,
561+
// `Initializing ${workerPromises.length} workers...`,
562+
// );
563+
// // Show initial progress immediately
564+
// progressBar.update(0);
565+
// }
566+
567+
// // Track all workers in parallel and update progress as each completes
568+
// let completedCount = 0;
569+
// const results = await Promise.allSettled(
570+
// workerPromises.map(async (workerPromise) => {
571+
// try {
572+
// const worker = await workerPromise;
573+
// completedCount++;
574+
// if (useProgressBar && progressBar) {
575+
// progressBar.update(completedCount);
576+
// }
577+
// return worker;
578+
// } catch (error) {
579+
// completedCount++;
580+
// if (useProgressBar && progressBar) {
581+
// progressBar.update(completedCount);
582+
// }
583+
// throw error;
584+
// }
585+
// }),
586+
// );
587+
588+
// // Check for any failures
589+
// const failedResults = results.filter(
590+
// (result) => result.status === "rejected",
591+
// );
592+
// if (failedResults.length > 0) {
593+
// throw failedResults[0].reason;
594+
// }
595+
596+
// // Extract successful results
597+
// const successfulResults = results.map(
598+
// (result) => (result as PromiseFulfilledResult<Worker>).value,
599+
// );
593600

594601
// Add all successful workers to the manager
595602
for (const worker of successfulResults) {
@@ -618,12 +625,11 @@ function getNextFolderName(): string {
618625
const dataPath = path.resolve(process.cwd(), ".data");
619626
let folder = "a";
620627
if (fs.existsSync(dataPath)) {
621-
const existingFolders = fs
622-
.readdirSync(dataPath)
623-
.filter((f) => /^[a-z]$/.test(f));
624-
folder = String.fromCharCode(
625-
"a".charCodeAt(0) + (existingFolders.length % 26),
626-
);
628+
const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
629+
folder = Array.from(
630+
{ length: 32 },
631+
() => chars[Math.floor(Math.random() * chars.length)],
632+
).join("");
627633
}
628634
return folder;
629635
}

0 commit comments

Comments
 (0)