* great typescript module import refactor * refactor metamigo-cli so it is the entrypoint for the db, api, and worker
19 lines
539 B
TypeScript
19 lines
539 B
TypeScript
import * as Worker from "graphile-worker";
|
|
import { defState } from "@digiresilience/montar";
|
|
import config from "./config.js";
|
|
|
|
const startWorkerUtils = async (): Promise<Worker.WorkerUtils> => {
|
|
const workerUtils = await Worker.makeWorkerUtils({
|
|
connectionString: config.worker.connection,
|
|
});
|
|
return workerUtils;
|
|
};
|
|
|
|
const stopWorkerUtils = async (): Promise<void> => workerUtils.release();
|
|
|
|
const workerUtils = defState("apiWorkerUtils", {
|
|
start: startWorkerUtils,
|
|
stop: stopWorkerUtils,
|
|
});
|
|
|
|
export default workerUtils;
|