retrying docker communication to net
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
90766a7522
commit
3a9b6704cd
|
|
@ -14,10 +14,17 @@ services:
|
||||||
image: git.georgew.dev/georgew/mission-control-worker:latest
|
image: git.georgew.dev/georgew/mission-control-worker:latest
|
||||||
container_name: mc-worker
|
container_name: mc-worker
|
||||||
restart: always
|
restart: always
|
||||||
|
command: npx tsx scripts/update-space.ts
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
environment:
|
environment:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
|
depends_on:
|
||||||
|
- mc-web
|
||||||
|
dns:
|
||||||
|
- 8.8.8.8
|
||||||
|
- 1.1.1.1
|
||||||
|
network_mode: "bridge"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
web_traffic:
|
web_traffic:
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,11 @@ import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { CosmicEvent } from '@/types/space';
|
import { CosmicEvent } from '@/types/space';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const MY_LAT = 55.6683;
|
const MY_LAT = 55.6683;
|
||||||
const MY_LON = 12.5333;
|
const MY_LON = 12.5333;
|
||||||
const MY_ALT = 0;
|
const MY_ALT = 0;
|
||||||
|
|
||||||
|
|
||||||
async function updateISSData() {
|
async function updateISSData() {
|
||||||
console.log("🛰️ Fetching TLE data...");
|
console.log("🛰️ Fetching TLE data...");
|
||||||
|
|
||||||
|
|
@ -155,14 +154,43 @@ async function updateAllData() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await updateISSData();
|
await updateISSData();
|
||||||
updateMoonPhase();
|
} catch (e) {
|
||||||
updateCosmicEvents();
|
console.error("⚠️ ISS sync failed (Timeout/Network)", e);
|
||||||
await updateRocketLaunches();
|
}
|
||||||
|
|
||||||
console.log("✅ All systems synchronized.");
|
try {
|
||||||
} catch (error) {
|
updateMoonPhase();
|
||||||
console.error("❌ Sync failed:", error);
|
} catch (e) {
|
||||||
|
console.error("⚠️ Moon sync failed", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
updateCosmicEvents();
|
||||||
|
} catch (e) {
|
||||||
|
console.error("⚠️ Cosmic sync failed", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await updateRocketLaunches();
|
||||||
|
} catch (e) {
|
||||||
|
console.error("⚠️ Rocket sync failed", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAllData().catch(console.error);
|
async function startWorker() {
|
||||||
|
console.log("🛰️ Ground Station Worker started...");
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
await updateAllData();
|
||||||
|
console.log("✅ Sync complete. Sleeping for 1 hour...");
|
||||||
|
} catch (err) {
|
||||||
|
console.error("❌ Worker loop error:", err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sleep for 3600000ms (1 hour)
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 3600000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
startWorker();
|
||||||
Loading…
Reference in a new issue