remove counts
This commit is contained in:
parent
c2b3e81936
commit
3273adaaa1
2 changed files with 12 additions and 2 deletions
|
@ -7,6 +7,7 @@ import { MoreThan } from "typeorm";
|
||||||
import { index } from "@/services/note/create.js";
|
import { index } from "@/services/note/create.js";
|
||||||
import { Note } from "@/models/entities/note.js";
|
import { Note } from "@/models/entities/note.js";
|
||||||
import meilisearch from "../../../db/meilisearch.js";
|
import meilisearch from "../../../db/meilisearch.js";
|
||||||
|
import { scyllaClient } from "@/db/scylla.js";
|
||||||
|
|
||||||
const logger = queueLogger.createSubLogger("index-all-notes");
|
const logger = queueLogger.createSubLogger("index-all-notes");
|
||||||
|
|
||||||
|
@ -55,7 +56,11 @@ export default async function indexAllNotes(
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const count = await Notes.count();
|
const count = await (scyllaClient
|
||||||
|
? scyllaClient
|
||||||
|
.execute("SELECT COUNT(1) FROM note")
|
||||||
|
.then((result) => result.first().get("count") as number)
|
||||||
|
: Notes.count());
|
||||||
total = count;
|
total = count;
|
||||||
await job.update({ indexedCount, cursor, total });
|
await job.update({ indexedCount, cursor, total });
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { fetchMeta } from "@/misc/fetch-meta.js";
|
||||||
import { Users, Notes } from "@/models/index.js";
|
import { Users, Notes } from "@/models/index.js";
|
||||||
import { IsNull } from "typeorm";
|
import { IsNull } from "typeorm";
|
||||||
import { MAX_NOTE_TEXT_LENGTH, FILE_TYPE_BROWSERSAFE } from "@/const.js";
|
import { MAX_NOTE_TEXT_LENGTH, FILE_TYPE_BROWSERSAFE } from "@/const.js";
|
||||||
|
import { scyllaClient } from "@/db/scylla";
|
||||||
|
|
||||||
export async function getInstance(
|
export async function getInstance(
|
||||||
response: Entity.Instance,
|
response: Entity.Instance,
|
||||||
|
@ -12,7 +13,11 @@ export async function getInstance(
|
||||||
const [meta, totalUsers, totalStatuses] = await Promise.all([
|
const [meta, totalUsers, totalStatuses] = await Promise.all([
|
||||||
fetchMeta(true),
|
fetchMeta(true),
|
||||||
Users.count({ where: { host: IsNull() } }),
|
Users.count({ where: { host: IsNull() } }),
|
||||||
Notes.count({ where: { userHost: IsNull() } }),
|
scyllaClient
|
||||||
|
? scyllaClient
|
||||||
|
.execute("SELECT COUNT(1) FROM note")
|
||||||
|
.then((result) => result.first().get("count") as number)
|
||||||
|
: Notes.count({ where: { userHost: IsNull() } }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue