perf(server): Cache user keypair
This commit is contained in:
parent
202e943d55
commit
7c3086e9d9
5 changed files with 21 additions and 15 deletions
|
@ -13,10 +13,11 @@ import Following from './activitypub/following';
|
|||
import Featured from './activitypub/featured';
|
||||
import { inbox as processInbox } from '../queue';
|
||||
import { isSelfHost } from '../misc/convert-host';
|
||||
import { Notes, Users, Emojis, UserKeypairs, NoteReactions } from '../models';
|
||||
import { Notes, Users, Emojis, NoteReactions } from '../models';
|
||||
import { ILocalUser, User } from '../models/entities/user';
|
||||
import { In } from 'typeorm';
|
||||
import { renderLike } from '../remote/activitypub/renderer/like';
|
||||
import { getUserKeypair } from '../misc/keypair-store';
|
||||
|
||||
// Init router
|
||||
const router = new Router();
|
||||
|
@ -135,7 +136,7 @@ router.get('/users/:user/publickey', async ctx => {
|
|||
return;
|
||||
}
|
||||
|
||||
const keypair = await UserKeypairs.findOneOrFail(user.id);
|
||||
const keypair = await getUserKeypair(user.id);
|
||||
|
||||
if (Users.isLocalUser(user)) {
|
||||
ctx.body = renderActivity(renderKey(user, keypair));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue