Make bridge worker settings configuration via env vars
This commit is contained in:
parent
2489a6f891
commit
48aa89f7cf
2 changed files with 16 additions and 5 deletions
|
|
@ -4,8 +4,12 @@ import type {} from "graphile-worker";
|
||||||
const preset: GraphileConfig.Preset = {
|
const preset: GraphileConfig.Preset = {
|
||||||
worker: {
|
worker: {
|
||||||
connectionString: process.env.DATABASE_URL,
|
connectionString: process.env.DATABASE_URL,
|
||||||
maxPoolSize: 10,
|
maxPoolSize: process.env.BRIDGE_WORKER_POOL_SIZE
|
||||||
pollInterval: 2000,
|
? parseInt(process.env.BRIDGE_WORKER_POOL_SIZE, 10)
|
||||||
|
: 10,
|
||||||
|
pollInterval: process.env.BRIDGE_WORKER_POLL_INTERVAL
|
||||||
|
? parseInt(process.env.BRIDGE_WORKER_POLL_INTERVAL, 10)
|
||||||
|
: 2000,
|
||||||
fileExtensions: [".ts"],
|
fileExtensions: [".ts"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,19 @@ const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
const startWorker = async () => {
|
const startWorker = async () => {
|
||||||
console.log("Starting worker...");
|
console.log("Starting worker...");
|
||||||
console.log(process.env);
|
|
||||||
await run({
|
await run({
|
||||||
connectionString: process.env.DATABASE_URL,
|
connectionString: process.env.DATABASE_URL,
|
||||||
concurrency: 10,
|
|
||||||
noHandleSignals: false,
|
noHandleSignals: false,
|
||||||
pollInterval: 1000,
|
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`,
|
taskDirectory: `${__dirname}/tasks`,
|
||||||
crontabFile: `${__dirname}/crontab`,
|
crontabFile: `${__dirname}/crontab`,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue