Merge branch 'develop' into cache-user-info

This commit is contained in:
syuilo 2022-03-21 05:45:41 +09:00
commit 1905870f7a
3 changed files with 4 additions and 4 deletions

View File

@ -85,7 +85,7 @@ class MyCustomLogger implements Logger {
public logQuery(query: string, parameters?: any[]) { public logQuery(query: string, parameters?: any[]) {
if (envOption.verbose) { if (envOption.verbose) {
sqlLogger.info(this.highlight(query)); sqlLogger.info(this.highlight(query).substring(0, 100));
} }
} }

View File

@ -53,9 +53,7 @@ export default async function renderNote(note: Note, dive = true, isTalk = false
} }
} }
const user = await Users.findOneOrFail(note.userId); const attributedTo = `${config.url}/users/${note.userId}`;
const attributedTo = `${config.url}/users/${user.id}`;
const mentions = (JSON.parse(note.mentionedRemoteUsers) as IMentionedRemoteUsers).map(x => x.uri); const mentions = (JSON.parse(note.mentionedRemoteUsers) as IMentionedRemoteUsers).map(x => x.uri);

View File

@ -67,6 +67,7 @@ router.get('/notes/:note', async (ctx, next) => {
if (!isActivityPubReq(ctx)) return await next(); if (!isActivityPubReq(ctx)) return await next();
// TODO: typeorm 3.0にしたら .then(x => x || null) は消せる // TODO: typeorm 3.0にしたら .then(x => x || null) は消せる
// nginxとかでキャッシュしてくれそうだからそもそもnode側でのキャッシュ不要かも
const note = await noteCache.fetch(ctx.params.note, () => Notes.findOne({ const note = await noteCache.fetch(ctx.params.note, () => Notes.findOne({
id: ctx.params.note, id: ctx.params.note,
visibility: In(['public' as const, 'home' as const]), visibility: In(['public' as const, 'home' as const]),
@ -167,6 +168,7 @@ router.get('/users/:user', async (ctx, next) => {
const userId = ctx.params.user; const userId = ctx.params.user;
// TODO: typeorm 3.0にしたら .then(x => x || null) は消せる // TODO: typeorm 3.0にしたら .then(x => x || null) は消せる
// nginxとかでキャッシュしてくれそうだからそもそもnode側でのキャッシュ不要かも
const user = await userCache.fetch(userId, () => Users.findOne({ const user = await userCache.fetch(userId, () => Users.findOne({
id: userId, id: userId,
host: null, host: null,