23 lines
680 B
TypeScript
23 lines
680 B
TypeScript
import { hatchet } from "./client";
|
|
import { backendCalendarTimelineScheduler } from "./workflow";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
async function main() {
|
|
const worker = await hatchet.worker("backend-worker", {
|
|
workflows: [backendCalendarTimelineScheduler],
|
|
});
|
|
|
|
await worker.start();
|
|
}
|
|
|
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
|
|
if (isMain) {
|
|
main().catch((error) => {
|
|
const message = error instanceof Error ? error.stack || error.message : String(error);
|
|
console.error(`[backend_worker/hatchet] worker failed: ${message}`);
|
|
process.exitCode = 1;
|
|
});
|
|
}
|