mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-21 19:53:50 +01:00
[backend] Decrease default RecursionLimiter count to 10
This commit is contained in:
parent
1cbfd68a39
commit
80c9280682
@ -12,7 +12,7 @@ const queue = new Semaphore(5);
|
||||
|
||||
export const UserProfileRepository = db.getRepository(UserProfile).extend({
|
||||
// We must never await this without promiseEarlyReturn, otherwise giant webring-style profile mention trees will cause the queue to stop working
|
||||
async updateMentions(id: UserProfile["userId"], limiter: RecursionLimiter = new RecursionLimiter(20)){
|
||||
async updateMentions(id: UserProfile["userId"], limiter: RecursionLimiter = new RecursionLimiter()){
|
||||
const profile = await this.findOneBy({ userId: id });
|
||||
if (!profile) return;
|
||||
const tokens: mfm.MfmNode[] = [];
|
||||
@ -51,7 +51,7 @@ async function populateMentions(tokens: mfm.MfmNode[], objectHost: string | null
|
||||
export class RecursionLimiter {
|
||||
private counter;
|
||||
private mutex = new Mutex();
|
||||
constructor(count: number = 20) {
|
||||
constructor(count: number = 10) {
|
||||
this.counter = count;
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ export async function parseAudience(
|
||||
to?: ApObject,
|
||||
cc?: ApObject,
|
||||
resolver?: Resolver,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<AudienceInfo> {
|
||||
const toGroups = groupingAudience(getApIds(to), actor);
|
||||
const ccGroups = groupingAudience(getApIds(cc), actor);
|
||||
|
@ -10,7 +10,7 @@ import { RecursionLimiter } from "@/models/repositories/user-profile.js";
|
||||
|
||||
export async function extractApMentions(
|
||||
tags: IObject | IObject[] | null | undefined,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
) {
|
||||
const hrefs = unique(
|
||||
extractApMentionObjects(tags).map((x) => x.href as string),
|
||||
|
@ -109,7 +109,7 @@ export async function createNote(
|
||||
value: string | IObject,
|
||||
resolver?: Resolver,
|
||||
silent = false,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<Note | null> {
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
|
||||
@ -407,7 +407,7 @@ export async function createNote(
|
||||
export async function resolveNote(
|
||||
value: string | IObject,
|
||||
resolver?: Resolver,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<Note | null> {
|
||||
const uri = typeof value === "string" ? value : value.id;
|
||||
if (uri == null) throw new Error("missing uri");
|
||||
|
@ -171,7 +171,7 @@ export async function createPerson(
|
||||
uri: string,
|
||||
resolver?: Resolver,
|
||||
subjectHost?: string,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<User> {
|
||||
if (typeof uri !== "string") throw new Error("uri is not string");
|
||||
|
||||
@ -644,7 +644,7 @@ export async function updatePerson(
|
||||
export async function resolvePerson(
|
||||
uri: string,
|
||||
resolver?: Resolver,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<CacheableUser> {
|
||||
if (typeof uri !== "string") throw new Error("uri is not string");
|
||||
|
||||
@ -719,7 +719,7 @@ export async function analyzeAttachments(
|
||||
return { fields, services };
|
||||
}
|
||||
|
||||
export async function updateFeatured(userId: User["id"], resolver?: Resolver, limiter: RecursionLimiter = new RecursionLimiter(20)) {
|
||||
export async function updateFeatured(userId: User["id"], resolver?: Resolver, limiter: RecursionLimiter = new RecursionLimiter()) {
|
||||
const user = await Users.findOneByOrFail({ id: userId });
|
||||
if (!Users.isRemoteUser(user)) return;
|
||||
if (!user.featured) return;
|
||||
|
@ -34,7 +34,7 @@ export async function resolveUser(
|
||||
username: string,
|
||||
host: string | null,
|
||||
refresh: refreshType = 'refresh',
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<User> {
|
||||
const usernameLower = username.toLowerCase();
|
||||
|
||||
|
@ -168,7 +168,7 @@ export default async (
|
||||
},
|
||||
data: Option,
|
||||
silent = false,
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
) =>
|
||||
// rome-ignore lint/suspicious/noAsyncPromiseExecutor: FIXME
|
||||
new Promise<Note>(async (res, rej) => {
|
||||
@ -927,7 +927,7 @@ function incNotesCountOfUser(user: { id: User["id"] }) {
|
||||
export async function extractMentionedUsers(
|
||||
user: { host: User["host"] },
|
||||
tokens: mfm.MfmNode[],
|
||||
limiter: RecursionLimiter = new RecursionLimiter(20)
|
||||
limiter: RecursionLimiter = new RecursionLimiter()
|
||||
): Promise<User[]> {
|
||||
if (tokens == null) return [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user