fix: nodeinfo

This commit is contained in:
Namekuji 2023-09-02 09:57:32 -04:00
parent 697361ca03
commit fd4099a760
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
2 changed files with 16 additions and 1 deletions

View file

@ -157,6 +157,16 @@ CREATE MATERIALIZED VIEW local_timeline AS
PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility") PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility")
WITH CLUSTERING ORDER BY ("createdAt" DESC); WITH CLUSTERING ORDER BY ("createdAt" DESC);
CREATE MATERIALIZED VIEW local_note AS
SELECT "createdAtDate", "createdAt", "userId", "userHost", "visibility" FROM note
WHERE "createdAtDate" IS NOT NULL
AND "createdAt" IS NOT NULL
AND "userId" IS NOT NULL
AND "userHost" = 'local'
AND "visibility" IS NOT NULL
PRIMARY KEY ("createdAtDate", "createdAt", "userId", "userHost", "visibility")
WITH CLUSTERING ORDER BY ("createdAt" DESC);
CREATE MATERIALIZED VIEW score_feed AS CREATE MATERIALIZED VIEW score_feed AS
SELECT * FROM note SELECT * FROM note
WHERE "createdAtDate" IS NOT NULL WHERE "createdAtDate" IS NOT NULL

View file

@ -5,6 +5,7 @@ import { Users, Notes } from "@/models/index.js";
import { IsNull, MoreThan } from "typeorm"; import { IsNull, MoreThan } from "typeorm";
import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js"; import { MAX_NOTE_TEXT_LENGTH, MAX_CAPTION_TEXT_LENGTH } from "@/const.js";
import { Cache } from "@/misc/cache.js"; import { Cache } from "@/misc/cache.js";
import { scyllaClient } from "@/db/scylla";
const router = new Router(); const router = new Router();
@ -41,7 +42,11 @@ const nodeinfo2 = async () => {
lastActiveDate: MoreThan(new Date(now - 2592000000)), lastActiveDate: MoreThan(new Date(now - 2592000000)),
}, },
}), }),
Notes.count({ where: { userHost: IsNull() } }), scyllaClient
? scyllaClient
.execute("SELECT COUNT(1) FROM local_note")
.then((result) => result.first().get("count") as number)
: Notes.count({ where: { userHost: IsNull() } }),
]); ]);
const proxyAccount = meta.proxyAccountId const proxyAccount = meta.proxyAccountId