diff --git a/packages/backend/src/db/postgre.ts b/packages/backend/src/db/postgre.ts index 066a3c673..5fd1f95cc 100644 --- a/packages/backend/src/db/postgre.ts +++ b/packages/backend/src/db/postgre.ts @@ -85,7 +85,7 @@ class MyCustomLogger implements Logger { public logQuery(query: string, parameters?: any[]) { if (envOption.verbose) { - sqlLogger.info(this.highlight(query)); + sqlLogger.info(this.highlight(query).substring(0, 100)); } } diff --git a/packages/backend/src/remote/activitypub/renderer/note.ts b/packages/backend/src/remote/activitypub/renderer/note.ts index c3d9e120d..78190751f 100644 --- a/packages/backend/src/remote/activitypub/renderer/note.ts +++ b/packages/backend/src/remote/activitypub/renderer/note.ts @@ -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/${user.id}`; + const attributedTo = `${config.url}/users/${note.userId}`; const mentions = (JSON.parse(note.mentionedRemoteUsers) as IMentionedRemoteUsers).map(x => x.uri); diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index f2d320bb6..c0a9b3772 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -67,6 +67,7 @@ router.get('/notes/:note', async (ctx, next) => { if (!isActivityPubReq(ctx)) return await next(); // TODO: typeorm 3.0にしたら .then(x => x || null) は消せる + // nginxとかでキャッシュしてくれそうだからそもそもnode側でのキャッシュ不要かも? const note = await noteCache.fetch(ctx.params.note, () => Notes.findOne({ id: ctx.params.note, visibility: In(['public' as const, 'home' as const]), @@ -167,6 +168,7 @@ router.get('/users/:user', async (ctx, next) => { const userId = ctx.params.user; // TODO: typeorm 3.0にしたら .then(x => x || null) は消せる + // nginxとかでキャッシュしてくれそうだからそもそもnode側でのキャッシュ不要かも? const user = await userCache.fetch(userId, () => Users.findOne({ id: userId, host: null,