[backend] Reset home timeline query heuristic after importing follows

This commit is contained in:
Laura Hausmann 2024-07-04 00:08:21 +02:00
parent 09afdeb04c
commit e2b7d80871
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
2 changed files with 3 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import { Users, DriveFiles } from "@/models/index.js";
import type { DbUserImportJobData } from "@/queue/types.js";
import { queueLogger } from "../../logger.js";
import type Bull from "bull";
import { cache as heuristic } from "@/server/api/common/generate-following-query.js";
const logger = queueLogger.createSubLogger("import-following");
@ -111,6 +112,7 @@ export async function importFollowing(
}
}
await heuristic.delete(user.id);
logger.succ("Imported");
done();
}

View file

@ -4,7 +4,7 @@ import { Followings, Notes } from "@/models/index.js";
import { Cache } from "@/misc/cache.js";
import { apiLogger } from "@/server/api/logger.js";
const cache = new Cache<number>("homeTlQueryData", 60 * 60 * 24);
export const cache = new Cache<number>("homeTlQueryData", 60 * 60 * 24);
const cutoff = 250; // 250 posts in the last 7 days, constant determined by comparing benchmarks for cutoff values between 100 and 2500
const logger = apiLogger.createSubLogger("heuristics");