2023-02-13 12:41:30 +00:00
|
|
|
import * as Worker from "graphile-worker";
|
|
|
|
|
import { defState } from "@digiresilience/montar";
|
2023-03-13 22:14:52 +00:00
|
|
|
import config from "@digiresilience/metamigo-config";
|
2023-02-13 12:41:30 +00:00
|
|
|
|
|
|
|
|
const startWorkerUtils = async (): Promise<Worker.WorkerUtils> => {
|
|
|
|
|
const workerUtils = await Worker.makeWorkerUtils({
|
|
|
|
|
connectionString: config.worker.connection,
|
|
|
|
|
});
|
|
|
|
|
return workerUtils;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const stopWorkerUtils = async (): Promise<void> => {
|
|
|
|
|
return workerUtils.release();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const workerUtils = defState("workerUtils", {
|
|
|
|
|
start: startWorkerUtils,
|
|
|
|
|
stop: stopWorkerUtils,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default workerUtils;
|