@replayio/app-building 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fly.js +10 -2
- package/package.json +1 -1
package/dist/fly.js
CHANGED
|
@@ -127,14 +127,22 @@ export async function createMachine(app, token, image, env, name) {
|
|
|
127
127
|
*/
|
|
128
128
|
export async function waitForMachine(app, token, machineId, timeoutMs = 180000) {
|
|
129
129
|
const start = Date.now();
|
|
130
|
+
let lastLogTime = 0;
|
|
130
131
|
while (Date.now() - start < timeoutMs) {
|
|
131
132
|
try {
|
|
132
133
|
await flyFetch(`/apps/${app}/machines/${machineId}/wait?state=started&timeout=60`, token);
|
|
133
134
|
return;
|
|
134
135
|
}
|
|
135
136
|
catch (e) {
|
|
136
|
-
const
|
|
137
|
-
|
|
137
|
+
const now = Date.now();
|
|
138
|
+
const elapsed = Math.round((now - start) / 1000);
|
|
139
|
+
// Only log at most once every 10 seconds
|
|
140
|
+
if (now - lastLogTime >= 10000) {
|
|
141
|
+
console.log(`Still waiting for machine to start (${elapsed}s elapsed): ${e instanceof Error ? e.message : e}`);
|
|
142
|
+
lastLogTime = now;
|
|
143
|
+
}
|
|
144
|
+
// Wait before retrying
|
|
145
|
+
await new Promise((r) => setTimeout(r, 5000));
|
|
138
146
|
}
|
|
139
147
|
}
|
|
140
148
|
throw new Error(`Machine ${machineId} did not reach started state within ${timeoutMs / 1000}s`);
|