Queue native collection launches before async placement
This commit is contained in:
@@ -5,9 +5,17 @@ import { relDestForKind } from '../config.js';
|
||||
import { captureRecipe, summarizeRecipe } from '../fleet/launch-recipes.js';
|
||||
import { sha256Buffer } from '../fleet/files.js';
|
||||
import type { NativeLaunchInput } from './launch-preparation.js';
|
||||
import { choosePlacement, type PlacementOptions } from '../hosts/capacity.js';
|
||||
|
||||
parentPort!.on('message', ({ id, input }: { id: number; input: NativeLaunchInput }) => {
|
||||
parentPort!.on('message', (message: { id: number; kind: 'launch'; input: NativeLaunchInput } | { id: number; kind: 'placement'; input: PlacementOptions }) => {
|
||||
const { id } = message;
|
||||
try {
|
||||
if (message.kind === 'placement') {
|
||||
const decision = db().transaction(() => choosePlacement(message.input))();
|
||||
parentPort!.postMessage({ id, value: { hostId: decision.host.id, lastHeartbeat: decision.host.lastHeartbeat } });
|
||||
return;
|
||||
}
|
||||
const input = message.input;
|
||||
// All file versions and composed configuration belong to one snapshot.
|
||||
const recipe = db().transaction(() => ({ ...captureRecipe(input.game, input.mapSlug),
|
||||
native: input.native, image: input.instance.image }))();
|
||||
|
||||
Reference in New Issue
Block a user