Closing global DB using the standard function - not directly.
This commit is contained in:
parent
9899781fc5
commit
6afe3a28ef
|
@ -1,4 +1,5 @@
|
||||||
const { setTenantId, setGlobalDB, getGlobalDB } = require("../tenancy")
|
const { setTenantId, setGlobalDB, getGlobalDB } = require("../tenancy")
|
||||||
|
const { closeDB } = require("../db")
|
||||||
const ContextFactory = require("../context/FunctionContext")
|
const ContextFactory = require("../context/FunctionContext")
|
||||||
const { buildMatcherRegex, matches } = require("./matchers")
|
const { buildMatcherRegex, matches } = require("./matchers")
|
||||||
|
|
||||||
|
@ -18,7 +19,8 @@ module.exports = (
|
||||||
setGlobalDB(tenantId)
|
setGlobalDB(tenantId)
|
||||||
}
|
}
|
||||||
const destroyFn = async () => {
|
const destroyFn = async () => {
|
||||||
await getGlobalDB().close()
|
const db = getGlobalDB()
|
||||||
|
await closeDB(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContextFactory.getMiddleware(updateCtxFn, destroyFn)
|
return ContextFactory.getMiddleware(updateCtxFn, destroyFn)
|
||||||
|
|
Loading…
Reference in New Issue