Runner: Build-Auftraege mit Warteschlange

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-09-30 21:53:41 +00:00
1 parent 12513b73c3
commit 4ed7e5d7a5
3 files changed
+450 -1

No files matched your search

+6 -1
View File
@@ -1,9 +1,14 @@
import { loadConfig } from './config.js';
import { createApiServer } from './server.js';
import { createDocker } from './docker.js';
import { createJobs } from './jobs.js';
// Jobs/Dev/Proxy kommen in späteren Tasks; bis dahin nur Stubs, damit /status antwortet.
const config = loadConfig(process.env);
const jobs = { submit: () => { throw Object.assign(new Error('Noch nicht verfügbar'), { status: 503 }); }, get: () => null, queueLength: () => 0 };
const realJobs = createJobs({ config, docker: createDocker() });
// Die API antwortet auf POST /jobs/build mit { runId }.
const jobs = { submit: (job) => ({ runId: realJobs.submit(job) }), get: realJobs.get, queueLength: realJobs.queueLength };
setInterval(() => realJobs.pruneCache().catch((e) => console.error('pruneCache', e)), 24 * 3600e3).unref();
const dev = { ensure: async () => { throw Object.assign(new Error('Noch nicht verfügbar'), { status: 503 }); }, stop: async () => {}, list: () => [] };
createApiServer({ config, jobs, dev }).listen(config.apiPort, () => {