Improve MineGeo UI and application flows
Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 2m37s

This commit is contained in:
2026-10-18 11:44:04 +05:00
parent ad73132f15
commit a7085e4e80
50 changed files with 4790 additions and 703 deletions

View File

@@ -8,6 +8,7 @@ import { datasetSchema, faces, type TerrainSnapshot } from "../shared/protocol";
import { processFabricImages } from "../lib/fabric-images";
import { renderSnapshot } from "../renderer/render.mjs";
import type { Database } from "../shared/database";
import { dispatchTournamentAnnouncements } from "../lib/tournament-discord";
if (existsSync(".env.local")) process.loadEnvFile(".env.local");
const client = createClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
@@ -17,8 +18,31 @@ const client = createClient<Database>(
const worker = "worker-" + randomUUID();
let stopping = false;
let activeAbort: AbortController | null = null;
let tournamentTickRunning = false;
let tournamentWarningAt = 0;
async function tickTournaments() {
if (stopping || tournamentTickRunning) return;
tournamentTickRunning = true;
try {
check(await client.rpc("tick_tournaments"));
await dispatchTournamentAnnouncements(client);
} catch {
if (Date.now() - tournamentWarningAt >= 300000) {
tournamentWarningAt = Date.now();
console.error(
"Tournament scheduling paused; check database migrations and connectivity. The worker will retry.",
);
}
} finally {
tournamentTickRunning = false;
}
}
// This remains independent of long panorama render jobs and idle website traffic.
const tournamentTimer = setInterval(() => void tickTournaments(), 30000);
tournamentTimer.unref();
function stopWorker() {
stopping = true;
clearInterval(tournamentTimer);
activeAbort?.abort();
}
process.on("SIGINT", stopWorker);
@@ -364,6 +388,7 @@ async function processJob(job: {
}
}
let housekeeping = 0;
void tickTournaments();
console.log(`MineGeo ${worker} ready; PostgreSQL leases through Supabase API.`);
while (!stopping) {
try {