link-stack/apps/bridge-worker/index.ts

29 lines
658 B
TypeScript
Raw Normal View History

2024-05-14 15:31:44 +02:00
import { run } from "graphile-worker";
import * as path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const startWorker = async () => {
2024-06-05 15:12:48 +02:00
console.log("Starting worker...");
console.log(process.env);
2024-05-14 15:31:44 +02:00
await run({
connectionString: process.env.DATABASE_URL,
concurrency: 10,
noHandleSignals: false,
pollInterval: 1000,
taskDirectory: `${__dirname}/tasks`,
// crontabFile: `${__dirname}/crontab`,
});
};
const main = async () => {
await startWorker();
};
main().catch((err) => {
console.error(err);
process.exit(1);
});