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
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -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...");
|
||||
|
||||
|
|
@ -155,14 +154,43 @@ async function updateAllData() {
|
|||
|
||||
try {
|
||||
await updateISSData();
|
||||
updateMoonPhase();
|
||||
updateCosmicEvents();
|
||||
await updateRocketLaunches();
|
||||
} 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();
|
||||
Loading…
Reference in a new issue