refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries
This commit is contained in:
1 parent
3f1c6d02f6
commit
27c0f27434
268 files changed
+7468
-7852
No files matched your search
@@ -11,17 +11,17 @@ import { startWorker } from "../../../src/worker/index.ts";
|
||||
import { buildModules } from "./modules.ts";
|
||||
import { crashScript } from "./scripts.ts";
|
||||
|
||||
const url = Deno.env.get("DATABASE_URL") ?? "postgres://umt:umt@localhost:55433/umt";
|
||||
const biz = Deno.env.get("BIZ_SCHEMA")!;
|
||||
const ow = Deno.env.get("OW_SCHEMA")!;
|
||||
const sessionDir = Deno.env.get("SESSION_DIR")!;
|
||||
const url = process.env.DATABASE_URL ?? "postgres://umt:umt@localhost:55433/umt";
|
||||
const biz = process.env.BIZ_SCHEMA!;
|
||||
const ow = process.env.OW_SCHEMA!;
|
||||
const sessionDir = process.env.SESSION_DIR!;
|
||||
await import("@umt/db"); // 注册 int8 解析器
|
||||
const db = new Kysely<DB>({
|
||||
dialect: new PostgresDialect({
|
||||
pool: new pg.Pool({ connectionString: url, max: 8, options: `-c search_path=${biz},public` }),
|
||||
}),
|
||||
});
|
||||
const logger = createLogger({ level: Deno.env.get("E2E_LOG_LEVEL") === "debug" ? "debug" : "warn" });
|
||||
const logger = createLogger({ level: process.env.E2E_LOG_LEVEL === "debug" ? "debug" : "warn" });
|
||||
const config = ConfigSchema.parse({
|
||||
DATABASE_URL: url,
|
||||
SECRET_MASTER_KEY: "e2e-master-key-0123456789",
|
||||
@@ -43,10 +43,10 @@ const worker = await startWorker({
|
||||
agentConcurrency: 2,
|
||||
},
|
||||
});
|
||||
console.log(`worker ready pid=${Deno.pid}`);
|
||||
Deno.addSignalListener("SIGTERM", async () => {
|
||||
console.log(`worker ready pid=${process.pid}`);
|
||||
process.on("SIGTERM", async () => {
|
||||
await worker.stop().catch(() => {});
|
||||
await booted.engine.stop().catch(() => {});
|
||||
await db.destroy().catch(() => {});
|
||||
Deno.exit(0);
|
||||
process.exit(0);
|
||||
});
|
||||
Reference in new issue
Block a user