remove thenify use - no longer required

This commit is contained in:
Ray Bellis 2019-01-31 14:48:22 +00:00
parent ccb49dcdc1
commit b1c5024bcf
4 changed files with 20 additions and 23 deletions

View file

@ -21,7 +21,6 @@
var db = require("./DB");
var customError = require("../utils/customError");
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
const thenify = require("thenify").withCallback;
exports.getColorPalette = function() {
return [

View file

@ -22,11 +22,10 @@
var ueberDB = require("ueberdb2");
var settings = require("../utils/Settings");
var log4js = require('log4js');
const thenify = require("thenify").withCallback;
const util = require("util");
// set database settings
var db = new ueberDB.database(settings.dbType, settings.dbSettings, null, log4js.getLogger("ueberDB"));
let db = new ueberDB.database(settings.dbType, settings.dbSettings, null, log4js.getLogger("ueberDB"));
/**
* The UeberDB Object that provides the database functions
@ -37,24 +36,25 @@ exports.db = null;
* Initalizes the database with the settings provided by the settings module
* @param {Function} callback
*/
exports.init = thenify(function (callback) {
exports.init = function() {
// initalize the database async
db.init(function(err) {
if (err) {
// there was an error while initializing the database, output it and stop
console.error("ERROR: Problem while initalizing the database");
console.error(err.stack ? err.stack : err);
process.exit(1);
} else {
// everything ok
exports.db = db;
return new Promise((resolve, reject) => {
db.init(function(err) {
if (err) {
// there was an error while initializing the database, output it and stop
console.error("ERROR: Problem while initalizing the database");
console.error(err.stack ? err.stack : err);
process.exit(1);
} else {
// everything ok, set up Promise-based methods
['get', 'set', 'findKeys', 'getSub', 'setSub', 'remove', 'doShutdown'].forEach(fn => {
exports[fn] = util.promisify(db[fn].bind(db));
});
// set up Promise-based methods
['get', 'set', 'findKeys', 'getSub', 'setSub', 'remove', 'doShutdown'].forEach(fn => {
exports[fn] = util.promisify(db[fn].bind(db));
});
callback(null);
}
// exposed for those callers that need the underlying raw API
exports.db = db;
resolve();
}
});
});
});
}

View file

@ -25,7 +25,6 @@ var sessionManager = require("./SessionManager");
var settings = require("../utils/Settings");
var log4js = require('log4js');
var authLogger = log4js.getLogger("auth");
const thenify = require("thenify").withCallback;
/**
* This function controlls the access to a pad, it checks if the user can access a pad.

View file

@ -58,7 +58,6 @@
"slide": "1.1.6",
"socket.io": "2.1.1",
"swagger-node-express": "2.1.3",
"thenify": "^3.3.0",
"tinycon": "0.0.1",
"ueberdb2": "0.4.0",
"uglify-js": "2.6.2",