Migrate changes from other Metamigo repo
This commit is contained in:
parent
8669b09224
commit
27810142b3
11 changed files with 615 additions and 235 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import * as Worker from "graphile-worker";
|
||||
import { parseCronItems } from "graphile-worker";
|
||||
import { defState } from "@digiresilience/montar";
|
||||
import config from "config";
|
||||
import { initPgp } from "./db";
|
||||
|
|
@ -14,7 +15,14 @@ const logFactory = (scope: any) => (level: any, message: any, meta: any) => {
|
|||
};
|
||||
|
||||
export const configWorker = async (): Promise<Worker.RunnerOptions> => {
|
||||
const { connection, concurrency, pollInterval } = config.worker;
|
||||
const {
|
||||
connection,
|
||||
concurrency,
|
||||
pollInterval,
|
||||
leafcutter: {
|
||||
enabled: leafcutterEnabled
|
||||
}
|
||||
} = config.worker;
|
||||
logger.info({ concurrency, pollInterval }, "Starting worker");
|
||||
return {
|
||||
concurrency,
|
||||
|
|
@ -23,6 +31,10 @@ export const configWorker = async (): Promise<Worker.RunnerOptions> => {
|
|||
connectionString: connection,
|
||||
// eslint-disable-next-line unicorn/prefer-module
|
||||
taskDirectory: `${__dirname}/tasks`,
|
||||
parsedCronItems: parseCronItems(leafcutterEnabled ?
|
||||
[{ task: "import-label-studio", pattern: "*/15 * * * *" },
|
||||
{ task: "import-leafcutter", pattern: "*/17 * * * *" }] :
|
||||
[])
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue