mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-05 06:39:02 +02:00
Node redis (#13500)
* refactor: start migrating to node-redis * few more zset fixes * fix: db.scan * fix: list methods * fix set methods * fix: hash methods * use hasOwn, remove cloning * sorted set fixes * fix: so data is converted to strings before saving otherwise node-redis throws below error TypeError: "arguments[2]" must be of type "string | Buffer", got number instead. * chore: remove comments * fix: zrank string param * use new close * chore: up dbsearch * test: add log * test: more log * test: log failing test * test: catch errors in formatApiResponse add await so exception goes to catch * tetst: add log * fix: dont set null/undefined values * test: more fixes
This commit is contained in:
@@ -145,14 +145,15 @@ Controller.postInbox = async (req, res) => {
|
||||
const method = String(req.body.type).toLowerCase();
|
||||
if (!activitypub.inbox.hasOwnProperty(method)) {
|
||||
winston.warn(`[activitypub/inbox] Received Activity of type ${method} but unable to handle. Ignoring.`);
|
||||
console.log('[activitypub/inbox] method not found', method, req.body);
|
||||
return res.sendStatus(200);
|
||||
}
|
||||
|
||||
try {
|
||||
await activitypub.inbox[method](req);
|
||||
await activitypub.record(req.body);
|
||||
helpers.formatApiResponse(202, res);
|
||||
await helpers.formatApiResponse(202, res);
|
||||
} catch (e) {
|
||||
helpers.formatApiResponse(500, res, e);
|
||||
helpers.formatApiResponse(500, res, e).catch(err => winston.error(err.stack));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -448,6 +448,10 @@ helpers.getHomePageRoutes = async function (uid) {
|
||||
};
|
||||
|
||||
helpers.formatApiResponse = async (statusCode, res, payload) => {
|
||||
if (!res.hasOwnProperty('req')) {
|
||||
console.log('formatApiResponse', statusCode, payload);
|
||||
}
|
||||
|
||||
if (res.req.method === 'HEAD') {
|
||||
return res.sendStatus(statusCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user