MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / ensureDistinct

Method ensureDistinct

lib/compiler-finder.ts:428–446  ·  view source on GitHub ↗
(compilers: CompilerInfo[])

Source from the content-addressed store, hash-verified

426 }
427
428 ensureDistinct(compilers: CompilerInfo[]) {
429 const ids: Record<string, CompilerInfo[]> = {};
430 let foundClash = false;
431 for (const compiler of compilers) {
432 if (!ids[compiler.id]) ids[compiler.id] = [];
433 ids[compiler.id].push(compiler);
434 }
435 for (const [id, list] of Object.entries(ids)) {
436 if (list.length !== 1) {
437 foundClash = true;
438 logger.error(
439 `Compiler ID clash for '${id}' - used by ${list
440 .map(o => `lang:${o.lang} name:${o.name}`)
441 .join(', ')}`,
442 );
443 }
444 }
445 return {compilers, foundClash};
446 }
447
448 async retryPromise<T>(promiseFunc: () => Promise<T>, name: string, maxFails: number, retryMs: number) {
449 for (let fails = 0; fails < maxFails; ++fails) {

Callers 1

findMethod · 0.95

Calls 2

pushMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected