MCPcopy Create free account
hub / github.com/Fibi66/FeiControl / runPublicSmokeCheck

Function runPublicSmokeCheck

scripts/dev-server.cjs:102–131  ·  view source on GitHub ↗
(host, port)

Source from the content-addressed store, hash-verified

100}
101
102async function runPublicSmokeCheck(host, port) {
103 const deadline = Date.now() + PUBLIC_SMOKE_TIMEOUT_MS;
104 let lastError = new Error('public runtime did not become healthy');
105
106 while (Date.now() < deadline) {
107 try {
108 const loginResponse = await requestRuntime(host, port, '/login');
109 if (loginResponse.statusCode !== 200) {
110 throw new Error(`/login returned ${loginResponse.statusCode}`);
111 }
112
113 const assetPath = extractStaticAssetPath(loginResponse.body);
114 if (!assetPath) {
115 throw new Error('/login did not reference any /_next/static asset');
116 }
117
118 const assetResponse = await requestRuntime(host, port, assetPath, 'HEAD');
119 if (assetResponse.statusCode !== 200) {
120 throw new Error(`${assetPath} returned ${assetResponse.statusCode}`);
121 }
122
123 return assetPath;
124 } catch (error) {
125 lastError = error;
126 await delay(PUBLIC_SMOKE_RETRY_MS);
127 }
128 }
129
130 throw lastError;
131}
132
133function stopChild(child, signal = 'SIGTERM') {
134 return new Promise((resolve) => {

Callers 1

mainFunction · 0.85

Calls 3

requestRuntimeFunction · 0.85
extractStaticAssetPathFunction · 0.85
delayFunction · 0.70

Tested by

no test coverage detected