retrying docker communication to net
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
GeorgeWebberley 2026-01-28 21:18:25 +01:00
parent 90766a7522
commit 3a9b6704cd
2 changed files with 45 additions and 10 deletions

View file

@ -14,10 +14,17 @@ services:
image: git.georgew.dev/georgew/mission-control-worker:latest
container_name: mc-worker
restart: always
command: npx tsx scripts/update-space.ts
volumes:
- ./data:/app/data
environment:
- NODE_ENV=production
depends_on:
- mc-web
dns:
- 8.8.8.8
- 1.1.1.1
network_mode: "bridge"
networks:
web_traffic:

View file

@ -4,12 +4,11 @@ import path from 'path';
import fs from 'fs';
import { CosmicEvent } from '@/types/space';
const MY_LAT = 55.6683;
const MY_LON = 12.5333;
const MY_ALT = 0;
async function updateISSData() {
console.log("🛰️ Fetching TLE data...");
@ -154,15 +153,44 @@ async function updateAllData() {
console.log("📡 Starting Ground Station sync...");
try {
await updateISSData();
updateMoonPhase();
updateCosmicEvents();
await updateRocketLaunches();
await updateISSData();
} catch (e) {
console.error("⚠️ ISS sync failed (Timeout/Network)", e);
}
console.log("✅ All systems synchronized.");
} catch (error) {
console.error("❌ Sync failed:", error);
try {
updateMoonPhase();
} 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();