fix: default limit should be 100

This commit is contained in:
Namekuji 2023-09-19 18:31:01 -04:00
parent 0745a4a862
commit 3f7e260985
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
3 changed files with 10 additions and 6 deletions

View file

@ -80,8 +80,10 @@ db:
# sparseTimelineDays: 14
#
# # <queryLimit> determines the number of maximum rows read within one pagination.
# # (default 1000, max 5000, min 1)
# queryLimit: 1000
# # You may need to make [max_clustering_key_restrictions_per_query] bigger for ScyllaDB
# # if you want to set this value larger than 100.
# # (default 100, max 5000, min 1)
# queryLimit: 100
# ┌─────────────────────┐
#───┘ Redis configuration └─────────────────────────────────────

View file

@ -437,7 +437,7 @@ export async function execPaginationQuery(
let scannedPartitions = 0;
const found: ScyllaNote[] | ScyllaNotification[] | ScyllaNoteReaction[] = [];
const queryLimit = config.scylla?.queryLimit ?? 1000;
const queryLimit = config.scylla?.queryLimit ?? 100;
let foundLimit = ps.limit;
if (kind === "list" && ps.userIds) {
foundLimit *= ps.userIds.length;
@ -468,7 +468,7 @@ export async function execPaginationQuery(
params.push(sinceDate);
}
const fetchLimit = kind === "list" ? ps.limit : queryLimit;
const fetchLimit = kind === "list" && ps.limit < 100 ? ps.limit : queryLimit;
params.push(fetchLimit);
const result = await scyllaClient.execute(query, params, {

View file

@ -12,6 +12,7 @@ import {
scyllaClient,
} from "@/db/scylla.js";
import { LocalFollowingsCache } from "@/misc/cache.js";
import type { Client } from "cassandra-driver";
export const meta = {
tags: ["users", "reactions"],
@ -63,6 +64,8 @@ export default define(meta, paramDef, async (ps, me) => {
}
if (scyllaClient) {
const client: Client = scyllaClient
let followingUserIds: string[] = [];
if (me) {
followingUserIds = await LocalFollowingsCache.init(me.id).then((cache) =>
@ -71,10 +74,9 @@ export default define(meta, paramDef, async (ps, me) => {
}
const filter = async (reactions: ScyllaNoteReaction[]) => {
if (!scyllaClient) return reactions;
let noteIds = reactions.map(({ noteId }) => noteId);
if (me) {
const notes = await scyllaClient
const notes = await client
.execute(prepared.note.select.byIds, [noteIds], { prepare: true })
.then((result) => result.rows.map(parseScyllaNote));
const filteredNoteIds = await filterVisibility(