fluxy-bot 0.5.22 → 0.5.23
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/package.json +1 -1
- package/supervisor/index.ts +15 -6
package/package.json
CHANGED
package/supervisor/index.ts
CHANGED
|
@@ -715,18 +715,27 @@ export async function startSupervisor() {
|
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
-
// Poll until the full chain is actually working
|
|
719
|
-
//
|
|
718
|
+
// Poll until the full relay→tunnel→server chain is actually working.
|
|
719
|
+
// A 502/503 means the relay can't reach the tunnel yet; anything else
|
|
720
|
+
// (200, 401, 403, etc.) means the chain is live.
|
|
720
721
|
const probeUrl = config.relay?.url || tunnelUrl;
|
|
721
722
|
let ready = false;
|
|
722
|
-
|
|
723
|
+
log.info(`Readiness probe: polling ${probeUrl}`);
|
|
724
|
+
for (let i = 0; i < 30; i++) {
|
|
723
725
|
try {
|
|
724
726
|
const res = await fetch(probeUrl + `/api/health?_cb=${Date.now()}`, {
|
|
725
727
|
signal: AbortSignal.timeout(3000),
|
|
726
|
-
headers: { 'Cache-Control': 'no-cache' },
|
|
728
|
+
headers: { 'Cache-Control': 'no-cache, no-store' },
|
|
727
729
|
});
|
|
728
|
-
|
|
729
|
-
|
|
730
|
+
log.info(`Readiness probe #${i + 1}: ${res.status}`);
|
|
731
|
+
// Any non-502/503 means the relay is reaching the tunnel
|
|
732
|
+
if (res.status !== 502 && res.status !== 503) {
|
|
733
|
+
ready = true;
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
} catch (err) {
|
|
737
|
+
log.info(`Readiness probe #${i + 1}: ${err instanceof Error ? err.message : 'error'}`);
|
|
738
|
+
}
|
|
730
739
|
await new Promise(r => setTimeout(r, 1000));
|
|
731
740
|
}
|
|
732
741
|
if (!ready) {
|