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

Function waitForDeploys

cypress/plugins/gitGateway.js:70–94  ·  view source on GitHub ↗
(netlifyApiToken, siteId)

Source from the content-addressed store, hash-verified

68}
69
70async function waitForDeploys(netlifyApiToken, siteId) {
71 const maxRetries = 5;
72 const retryDelayMs = 15 * 1000; // 15 seconds between retries
73
74 for (let i = 0; i < maxRetries; i++) {
75 try {
76 const deploys = await fetchWithTimeout(netlifyApiToken, `sites/${siteId}/deploys`);
77
78 if (deploys && deploys.some(deploy => deploy.state === 'ready')) {
79 return;
80 }
81
82 if (i < maxRetries - 1) {
83 await new Promise(resolve => setTimeout(resolve, retryDelayMs));
84 }
85 } catch (error) {
86 console.error(`Error checking deploy status: ${error.message}`);
87 if (i < maxRetries - 1) {
88 await new Promise(resolve => setTimeout(resolve, retryDelayMs));
89 }
90 }
91 }
92
93 throw new Error(`Timed out waiting for deploy of site ${siteId} after ${maxRetries * retryDelayMs / 1000}s`);
94}
95
96const netlifySiteURL = 'https://fake-site-url.netlify.com/';
97const email = 'decap@p-m.si';

Callers 1

setupGitGatewayFunction · 0.85

Calls 2

someMethod · 0.80
fetchWithTimeoutFunction · 0.70

Tested by

no test coverage detected