From c538a40bbde593446cd1dce3e47dc9f8d8af553c Mon Sep 17 00:00:00 2001 From: Daniel Bachler Date: Fri, 23 Feb 2024 18:25:33 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20minor=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adminSiteServer/apiRouter.ts | 6 +++--- adminSiteServer/exportGitData.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/adminSiteServer/apiRouter.ts b/adminSiteServer/apiRouter.ts index a40ac31bf6d..99f8116509b 100644 --- a/adminSiteServer/apiRouter.ts +++ b/adminSiteServer/apiRouter.ts @@ -1594,7 +1594,7 @@ apiRouter.get( ) apiRouter.get("/datasets.json", async (req) => { - await db.knexInstance().transaction( + return db.knexInstance().transaction( async (trx) => { const datasets = await db.knexRaw>( ` @@ -1658,7 +1658,7 @@ apiRouter.get("/datasets.json", async (req) => { apiRouter.get("/datasets/:datasetId.json", async (req: Request) => { const datasetId = expectInt(req.params.datasetId) - await db.knexInstance().transaction( + return db.knexInstance().transaction( async (trx) => { const dataset = await db.knexRawFirst>( ` @@ -2329,7 +2329,7 @@ apiRouter.post("/posts/:postId/unlinkGdoc", async (req: Request) => { apiRouter.get("/sources/:sourceId.json", async (req: Request) => { const sourceId = expectInt(req.params.sourceId) - db.knexInstance().transaction( + return db.knexInstance().transaction( async (trx) => { const source = await db.knexRawFirst>( ` diff --git a/adminSiteServer/exportGitData.ts b/adminSiteServer/exportGitData.ts index f05804f1c74..d4257dd1582 100644 --- a/adminSiteServer/exportGitData.ts +++ b/adminSiteServer/exportGitData.ts @@ -11,6 +11,7 @@ const main = async () => { if (!dataset.isPrivate && !dataset.nonRedistributable) await syncDatasetToGitRepo(knex, dataset.id, { commitOnly: true }) } + await db.closeTypeOrmAndKnexConnections() } main()