perf: add new user to cache

This commit is contained in:
Namekuji 2023-07-16 12:33:57 -04:00
parent 9c65f0078b
commit c47e125413
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532

View file

@ -28,7 +28,7 @@ import { fetchInstanceMetadata } from "@/services/fetch-instance-metadata.js";
import { normalizeForSearch } from "@/misc/normalize-for-search.js"; import { normalizeForSearch } from "@/misc/normalize-for-search.js";
import { truncate } from "@/misc/truncate.js"; import { truncate } from "@/misc/truncate.js";
import { StatusError } from "@/misc/fetch.js"; import { StatusError } from "@/misc/fetch.js";
import { uriPersonCache } from "@/services/user-cache.js"; import { uriPersonCache, userByIdCache } from "@/services/user-cache.js";
import { publishInternalEvent } from "@/services/stream.js"; import { publishInternalEvent } from "@/services/stream.js";
import { db } from "@/db/postgre.js"; import { db } from "@/db/postgre.js";
import { apLogger } from "../logger.js"; import { apLogger } from "../logger.js";
@ -373,6 +373,8 @@ export async function createPerson(
await updateFeatured(user!.id, resolver).catch((err) => logger.error(err)); await updateFeatured(user!.id, resolver).catch((err) => logger.error(err));
await userByIdCache.set(user.id, {...user, emojis, avatar, banner});
return user!; return user!;
} }