PR comments.
This commit is contained in:
parent
5057994b45
commit
fcfe1341a1
|
@ -1,13 +1,12 @@
|
|||
const pouch = require("./pouch")
|
||||
const env = require("../environment")
|
||||
|
||||
const MEMORY_LEAK_CHECK = 0
|
||||
const openDbs = []
|
||||
let PouchDB
|
||||
let initialised = false
|
||||
const dbList = new Set()
|
||||
|
||||
if (MEMORY_LEAK_CHECK) {
|
||||
if (env.MEMORY_LEAK_CHECK) {
|
||||
setInterval(() => {
|
||||
console.log("--- OPEN DBS ---")
|
||||
console.log(openDbs)
|
||||
|
@ -44,7 +43,7 @@ exports.dangerousGetDB = (dbName, opts) => {
|
|||
dbList.add(dbName)
|
||||
}
|
||||
const db = new PouchDB(dbName, opts)
|
||||
if (MEMORY_LEAK_CHECK) {
|
||||
if (env.MEMORY_LEAK_CHECK) {
|
||||
openDbs.push(db.name)
|
||||
}
|
||||
const dbPut = db.put
|
||||
|
@ -58,7 +57,7 @@ exports.closeDB = async db => {
|
|||
if (!db || env.isTest()) {
|
||||
return
|
||||
}
|
||||
if (MEMORY_LEAK_CHECK) {
|
||||
if (env.MEMORY_LEAK_CHECK) {
|
||||
openDbs.splice(openDbs.indexOf(db.name), 1)
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -54,6 +54,7 @@ const env = {
|
|||
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
||||
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
||||
SERVICE: process.env.SERVICE || "budibase",
|
||||
MEMORY_LEAK_CHECK: process.env.MEMORY_LEAK_CHECK || false,
|
||||
DEPLOYMENT_ENVIRONMENT:
|
||||
process.env.DEPLOYMENT_ENVIRONMENT || "docker-compose",
|
||||
_set(key: any, value: any) {
|
||||
|
|
Loading…
Reference in New Issue