MCPcopy Create free account
hub / github.com/decaporg/decap-cms / waitForPropagation

Function waitForPropagation

scripts/verify-published-packages.mjs:288–314  ·  view source on GitHub ↗

* Re-check packages the registry has not caught up on yet, until they settle or * the settle window expires. Only absent versions and lagging provenance are * retried: an unresolved specifier is a fact about the published manifest and * will never fix itself. Provenance still missing at the deadl

(registry, pending, context)

Source from the content-addressed store, hash-verified

286 * will never fix itself. Provenance still missing at the deadline is broken.
287 */
288async function waitForPropagation(registry, pending, context) {
289 const deadline = Date.now() + PROPAGATION_SETTLE_MS;
290 let remaining = pending;
291 const broken = [];
292
293 while (remaining.length > 0 && Date.now() < deadline) {
294 const waitSeconds = Math.round(PROPAGATION_POLL_MS / 1000);
295 log(` ${remaining.length} not settled yet, re-checking in ${waitSeconds}s...`);
296 await delay(PROPAGATION_POLL_MS);
297
298 const unsettled = [];
299 for (const pkg of remaining) {
300 const { status, issues } = await checkPackage(registry, pkg, context);
301 if (status === 'ok') {
302 log(` ${pkg.name}@${pkg.version} OK (settled after propagation)`);
303 } else if (status === 'broken') {
304 broken.push({ ...pkg, issues });
305 } else {
306 unsettled.push({ ...pkg, status, issues });
307 }
308 }
309 remaining = unsettled;
310 }
311
312 broken.push(...remaining.filter(pkg => pkg.status === 'settling'));
313 return { missing: remaining.filter(pkg => pkg.status !== 'settling'), broken };
314}
315
316async function main() {
317 const { registry, allowMissing, expectTag, allowUnattested } = parseArgs(process.argv.slice(2));

Callers 1

mainFunction · 0.85

Calls 4

checkPackageFunction · 0.85
filterMethod · 0.80
logFunction · 0.70
delayFunction · 0.70

Tested by

no test coverage detected