1
0
Fork 0
mirror of synced 2024-08-11 16:12:19 +12:00

Closing global DB using the standard function - not directly.

This commit is contained in:
mike12345567 2022-04-20 18:07:48 +01:00
parent 9899781fc5
commit 6afe3a28ef

View file

@ -1,4 +1,5 @@
const { setTenantId, setGlobalDB, getGlobalDB } = require("../tenancy")
const { closeDB } = require("../db")
const ContextFactory = require("../context/FunctionContext")
const { buildMatcherRegex, matches } = require("./matchers")
@ -18,7 +19,8 @@ module.exports = (
setGlobalDB(tenantId)
}
const destroyFn = async () => {
await getGlobalDB().close()
const db = getGlobalDB()
await closeDB(db)
}
return ContextFactory.getMiddleware(updateCtxFn, destroyFn)