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 () => { console.log("Starting worker..."); await run({ connectionString: process.env.DATABASE_URL, noHandleSignals: false, concurrency: process.env.BRIDGE_WORKER_CONCURRENCY ? parseInt(process.env.BRIDGE_WORKER_CONCURRENCY, 10) : 10, maxPoolSize: process.env.BRIDGE_WORKER_POOL_SIZE ? parseInt(process.env.BRIDGE_WORKER_POOL_SIZE, 10) : 10, pollInterval: process.env.BRIDGE_WORKER_POLL_INTERVAL ? parseInt(process.env.BRIDGE_WORKER_POLL_INTERVAL, 10) : 1000, taskDirectory: `${__dirname}/tasks`, crontabFile: `${__dirname}/crontab`, }); }; const main = async () => { await startWorker(); }; main().catch((err) => { console.error(err); process.exit(1); });