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

Function registryStatus

scripts/ga-preflight.mjs:65–83  ·  view source on GitHub ↗
(name, version)

Source from the content-addressed store, hash-verified

63}
64
65async function registryStatus(name, version) {
66 const url = `${REGISTRY}/${name.replaceAll('/', '%2f')}/${version}`;
67 for (let attempt = 1; ; attempt++) {
68 try {
69 const response = await fetch(url, { method: 'GET', headers: { accept: 'application/json' } });
70 if (response.status < 500 && response.status !== 429) {
71 return response.status;
72 }
73 } catch (e) {
74 if (attempt === 3) {
75 return `fetch failed: ${e.message}`;
76 }
77 }
78 if (attempt === 3) {
79 return 'registry kept failing';
80 }
81 await new Promise(resolve => setTimeout(resolve, 2000));
82 }
83}
84
85async function main() {
86 const { remote } = parseArgs(process.argv.slice(2));

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected