mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-19 23:10:21 +01:00
Compare commits
7 Commits
custom-use
...
v1.17.2-be
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9410a73aaa | ||
|
|
b2652ae697 | ||
|
|
9f90bdcd59 | ||
|
|
b002d25421 | ||
|
|
902da54029 | ||
|
|
7c0da8fcbb | ||
|
|
6b4ef46ead |
@@ -2,7 +2,7 @@
|
|||||||
"name": "nodebb",
|
"name": "nodebb",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"description": "NodeBB Forum",
|
"description": "NodeBB Forum",
|
||||||
"version": "1.17.1",
|
"version": "1.17.2",
|
||||||
"homepage": "http://www.nodebb.org",
|
"homepage": "http://www.nodebb.org",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
"nodebb-plugin-dbsearch": "5.0.2",
|
"nodebb-plugin-dbsearch": "5.0.2",
|
||||||
"nodebb-plugin-emoji": "^3.5.0",
|
"nodebb-plugin-emoji": "^3.5.0",
|
||||||
"nodebb-plugin-emoji-android": "2.0.5",
|
"nodebb-plugin-emoji-android": "2.0.5",
|
||||||
"nodebb-plugin-markdown": "8.14.0",
|
"nodebb-plugin-markdown": "8.14.1",
|
||||||
"nodebb-plugin-mentions": "2.13.11",
|
"nodebb-plugin-mentions": "2.13.11",
|
||||||
"nodebb-plugin-spam-be-gone": "0.7.9",
|
"nodebb-plugin-spam-be-gone": "0.7.9",
|
||||||
"nodebb-rewards-essentials": "0.1.5",
|
"nodebb-rewards-essentials": "0.1.5",
|
||||||
|
|||||||
7
src/als.js
Normal file
7
src/als.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { AsyncLocalStorage } = require('async_hooks');
|
||||||
|
|
||||||
|
const asyncLocalStorage = new AsyncLocalStorage();
|
||||||
|
|
||||||
|
module.exports = asyncLocalStorage;
|
||||||
@@ -96,6 +96,10 @@ Hooks.fire = async function (hook, params) {
|
|||||||
winston.warn(`[plugins] Unknown hookType: ${hookType}, hook : ${hook}`);
|
winston.warn(`[plugins] Unknown hookType: ${hookType}, hook : ${hook}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (params && typeof params === 'object' && !params.hasOwnProperty('caller')) {
|
||||||
|
const als = require('../als');
|
||||||
|
params.caller = als.getStore();
|
||||||
|
}
|
||||||
const result = await hookTypeToMethod[hookType](hook, hookList, params);
|
const result = await hookTypeToMethod[hookType](hook, hookList, params);
|
||||||
|
|
||||||
if (hook !== 'action:plugins.firehook' && hook !== 'filter:plugins.firehook') {
|
if (hook !== 'action:plugins.firehook' && hook !== 'filter:plugins.firehook') {
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ function onConnection(socket) {
|
|||||||
onConnect(socket);
|
onConnect(socket);
|
||||||
socket.onAny((event, ...args) => {
|
socket.onAny((event, ...args) => {
|
||||||
const payload = { data: [event].concat(args) };
|
const payload = { data: [event].concat(args) };
|
||||||
onMessage(socket, payload);
|
const als = require('../als');
|
||||||
|
als.run({ uid: socket.uid }, onMessage, socket, payload);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('disconnect', () => {
|
socket.on('disconnect', () => {
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ function setupExpressApp(app) {
|
|||||||
app.use(middleware.addHeaders);
|
app.use(middleware.addHeaders);
|
||||||
app.use(middleware.processRender);
|
app.use(middleware.processRender);
|
||||||
auth.initialize(app, middleware);
|
auth.initialize(app, middleware);
|
||||||
|
const als = require('./als');
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
als.run({ uid: req.uid }, next);
|
||||||
|
});
|
||||||
app.use(middleware.autoLocale); // must be added after auth middlewares are added
|
app.use(middleware.autoLocale); // must be added after auth middlewares are added
|
||||||
|
|
||||||
const toobusy = require('toobusy-js');
|
const toobusy = require('toobusy-js');
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ describe('Sorted Set methods', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should work with big arrays (length > 100) ', async function () {
|
it('should work with big arrays (length > 100) ', async function () {
|
||||||
this.timeout(50000);
|
this.timeout(100000);
|
||||||
const keys = [];
|
const keys = [];
|
||||||
for (let i = 0; i < 400; i++) {
|
for (let i = 0; i < 400; i++) {
|
||||||
/* eslint-disable no-await-in-loop */
|
/* eslint-disable no-await-in-loop */
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ describe('Notifications', () => {
|
|||||||
assert(nids.includes(nid));
|
assert(nids.includes(nid));
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}, 1500);
|
}, 3000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user