mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-06 12:31:33 +01:00
add again
This commit is contained in:
@@ -59,8 +59,8 @@ mongoModule.questions = [
|
||||
},
|
||||
];
|
||||
|
||||
mongoModule.init = async function () {
|
||||
client = await connection.connect(nconf.get('mongo'));
|
||||
mongoModule.init = async function (opts) {
|
||||
client = await connection.connect(opts || nconf.get('mongo'));
|
||||
mongoModule.client = client.db();
|
||||
};
|
||||
|
||||
@@ -175,6 +175,9 @@ async function getCollectionStats(db) {
|
||||
|
||||
mongoModule.close = async function () {
|
||||
await client.close();
|
||||
if (mongoModule.objectCache) {
|
||||
mongoModule.objectCache.reset();
|
||||
}
|
||||
};
|
||||
|
||||
require('./mongo/main')(mongoModule);
|
||||
|
||||
@@ -45,9 +45,9 @@ postgresModule.questions = [
|
||||
},
|
||||
];
|
||||
|
||||
postgresModule.init = async function () {
|
||||
postgresModule.init = async function (opts) {
|
||||
const { Pool } = require('pg');
|
||||
const connOptions = connection.getConnectionOptions();
|
||||
const connOptions = connection.getConnectionOptions(opts);
|
||||
const pool = new Pool(connOptions);
|
||||
postgresModule.pool = pool;
|
||||
postgresModule.client = pool;
|
||||
|
||||
@@ -33,8 +33,8 @@ redisModule.questions = [
|
||||
];
|
||||
|
||||
|
||||
redisModule.init = async function () {
|
||||
redisModule.client = await connection.connect(nconf.get('redis'));
|
||||
redisModule.init = async function (opts) {
|
||||
redisModule.client = await connection.connect(opts || nconf.get('redis'));
|
||||
};
|
||||
|
||||
redisModule.createSessionStore = async function (options) {
|
||||
@@ -62,6 +62,9 @@ redisModule.checkCompatibilityVersion = function (version, callback) {
|
||||
|
||||
redisModule.close = async function () {
|
||||
await redisModule.client.quit();
|
||||
if (redisModule.objectCache) {
|
||||
redisModule.objectCache.reset();
|
||||
}
|
||||
};
|
||||
|
||||
redisModule.info = async function (cxn) {
|
||||
|
||||
Reference in New Issue
Block a user