Skip to content

Commit

Permalink
Defer concurrency control to maxSockets
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Jun 2, 2022
1 parent a19278f commit 73170c0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
32 changes: 21 additions & 11 deletions packages/definitions-parser/src/check-parse-results.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { ParseDefinitionsOptions } from "./get-definitely-typed";
import { TypingsData, AllPackages, formatTypingVersion } from "./packages";
import { mapDefined, nAtATime, FS, logger, writeLog, Logger, defaultCacheDir, max, min } from "@definitelytyped/utils";
import {
mapDefined,
FS,
logger,
writeLog,
Logger,
ProgressBar,
defaultCacheDir,
max,
min,
} from "@definitelytyped/utils";
import * as pacote from "pacote";
import * as semver from "semver";

Expand Down Expand Up @@ -30,17 +40,17 @@ export async function checkParseResults(
}

if (includeNpmChecks) {
await nAtATime(
10,
allPackages.allTypings(),
(pkg) => checkNpm(pkg, log, dependedOn),
options.progress
? {
name: "Checking for typed packages...",
flavor: (pkg) => pkg.desc,
}
: undefined
const allTypings = allPackages.allTypings();
const progress = options.progress && new ProgressBar({ name: "Checking for typed packages..." });
let i = 0;
await Promise.all(
allTypings.map((pkg) =>
checkNpm(pkg, log, dependedOn).then(() => {
if (progress) progress.update(++i / allTypings.length, pkg.desc);
})
)
);
if (progress) progress.done();
}

await writeLog("conflicts.md", logResult());
Expand Down
17 changes: 10 additions & 7 deletions packages/retag/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
loggerWithErrors,
LoggerWithErrors,
defaultCacheDir,
nAtATime,
} from "@definitelytyped/utils";
import {
AnyPackage,
Expand Down Expand Up @@ -65,12 +64,16 @@ async function tag(dry: boolean, nProcesses: number, name?: string) {
await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);
await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);
} else {
await nAtATime(10, await AllPackages.readLatestTypings(), async (pkg) => {
// Only update tags for the latest version of the package.
const version = await getLatestTypingVersion(pkg);
await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);
await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);
});
await Promise.all(
(
await AllPackages.readLatestTypings()
).map(async (pkg) => {
// Only update tags for the latest version of the package.
const version = await getLatestTypingVersion(pkg);
await updateTypeScriptVersionTags(pkg, version, publishClient, consoleLogger.info, dry);
await updateLatestTag(pkg.fullNpmName, version, publishClient, consoleLogger.info, dry);
})
);
}
// Don't tag notNeeded packages
}
Expand Down

0 comments on commit 73170c0

Please sign in to comment.