Closing global DB using the standard function - not directly.
This commit is contained in:
parent
7792a07899
commit
9ee1be79fb
|
@ -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