Each computer's Chrome profile now lives on the data volume (DATA_DIR/computer-browsers/<id>, mounted at ~/.cobble-browser) and Chrome is pointed at it with --user-data-dir. The sandbox image resets its own profile's preferences to session-only cookies on every boot, which signed every site out whenever Chrome exited. New profiles are seeded with the image's preferences minus that rule, stale Singleton links are removed before each provision, and existing computers are recreated once (skipped while a job runs on them). Co-Authored-By: Claude Opus 5.5 <[email protected]>
21 lines
577 B
TypeScript
21 lines
577 B
TypeScript
import BunSQLite from "@moduletrace/bun-sqlite";
|
|
|
|
type Params = {
|
|
computer_id: number | string;
|
|
};
|
|
|
|
/**
|
|
* Whether a job is working on the computer right now, so its browser or
|
|
* container must not be pulled from under it.
|
|
*/
|
|
export default async function isComputerBusy({ computer_id }: Params) {
|
|
return Boolean(
|
|
(
|
|
await BunSQLite.sql<{ id: number }>({
|
|
sql: `SELECT id FROM bots_queue WHERE computer_id = ? AND status = 'processing' LIMIT 1`,
|
|
values: [computer_id],
|
|
})
|
|
).payload?.[0],
|
|
);
|
|
}
|