more test fixes

This commit is contained in:
barisusakli
2016-10-16 21:51:42 +03:00
parent 15d948894d
commit 1a63672e66
11 changed files with 65 additions and 63 deletions

View File

@@ -19,7 +19,7 @@ module.exports = function (db, module) {
db.collection('objects').update({_key: key, value: value}, {$set: {score: parseInt(score, 10)}}, {upsert:true, w: 1}, function (err) {
if (err && err.message.startsWith('E11000 duplicate key error')) {
return module.sortedSetAdd(key, score, value, callback);
return process.nextTick(module.sortedSetAdd, key, score, value, callback);
}
callback(err);
});
@@ -572,7 +572,7 @@ module.exports = function (db, module) {
// https://jira.mongodb.org/browse/SERVER-14322
// https://docs.mongodb.org/manual/reference/command/findAndModify/#upsert-and-unique-index
if (err && err.message.startsWith('E11000 duplicate key error')) {
return module.sortedSetIncrBy(key, increment, value, callback);
return process.nextTick(module.sortedSetIncrBy, key, increment, value, callback);
}
callback(err, result && result.value ? result.value.score : null);
});

View File

@@ -1,6 +1,7 @@
"use strict";
var nconf = require('nconf');
var winston = require('winston');
var path = require('path');
var async = require('async');
var controllers = require('../controllers');
@@ -157,5 +158,10 @@ module.exports = function (app, middleware, hotswapIds) {
async.apply(plugins.reloadRoutes),
async.apply(authRoutes.reloadRoutes),
async.apply(user.addInterstitials)
]);
], function (err) {
if (err) {
return winston.error(err);
}
winston.info('Routes added');
});
};

View File

@@ -1,12 +1,10 @@
"use strict";
var SocketIO = require('socket.io');
var socketioWildcard = require('socketio-wildcard')();
var async = require('async');
var nconf = require('nconf');
var cookieParser = require('cookie-parser')(nconf.get('secret'));
var winston = require('winston');
var url = require('url');
var cookieParser = require('cookie-parser')(nconf.get('secret'));
var db = require('../database');
var logger = require('../logger');
@@ -19,6 +17,8 @@ var ratelimit = require('../middleware/ratelimit');
Sockets.init = function (server) {
requireModules();
var SocketIO = require('socket.io');
var socketioWildcard = require('socketio-wildcard')();
io = new SocketIO({
path: nconf.get('relative_path') + '/socket.io'
});

View File

@@ -65,6 +65,7 @@ module.exports.listen = function (callback) {
emitter.all(['templates:compiled', 'meta:js.compiled', 'meta:css.compiled'], function () {
winston.info('NodeBB Ready');
emitter.emit('nodebb:ready');
listen(callback);
});
@@ -100,6 +101,19 @@ function initializeNodeBB(callback) {
},
async.apply(plugins.fireHook, 'static:assets.prepare', {}),
async.apply(meta.js.bridgeModules, app),
function (next) {
plugins.fireHook('static:app.preload', {
app: app,
middleware: middleware
}, next);
},
function (next) {
plugins.fireHook('filter:hotswap.prepare', [], next);
},
function (hotswapIds, next) {
routes(app, middleware, hotswapIds);
next();
},
function (next) {
async.series([
async.apply(meta.templates.compile),
@@ -110,17 +124,6 @@ function initializeNodeBB(callback) {
async.apply(languages.init),
async.apply(meta.blacklist.load)
], next);
},
function (results, next) {
plugins.fireHook('static:app.preload', {
app: app,
middleware: middleware
}, next);
},
async.apply(plugins.fireHook, 'filter:hotswap.prepare', []),
function (hotswapIds, next) {
routes(app, middleware, hotswapIds);
next();
}
], callback);
}