From 08d0a45ee76cc8d85e360c83654d5ddcee4fab21 Mon Sep 17 00:00:00 2001 From: xianon Date: Sun, 6 Feb 2022 04:29:36 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20NodeInfo=20=E3=81=AE=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E6=95=B0=E3=81=A8=E6=8A=95=E7=A8=BF=E6=95=B0?= =?UTF-8?q?=E3=81=AE=E5=86=85=E5=AE=B9=E3=82=92=E8=A6=8B=E7=9B=B4=E3=81=99?= =?UTF-8?q?=20(#8255)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * NodeInfoのアクティブユーザーの取得方法を変更する * NodeInfoの投稿数の出力内容を見直す --- packages/backend/src/server/nodeinfo.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/server/nodeinfo.ts b/packages/backend/src/server/nodeinfo.ts index 44f32bf882..4209fc7f14 100644 --- a/packages/backend/src/server/nodeinfo.ts +++ b/packages/backend/src/server/nodeinfo.ts @@ -2,7 +2,7 @@ import * as Router from '@koa/router'; import config from '@/config/index'; import { fetchMeta } from '@/misc/fetch-meta'; import { Users, Notes } from '@/models/index'; -import { Not, IsNull, MoreThan } from 'typeorm'; +import { MoreThan } from 'typeorm'; const router = new Router(); @@ -25,14 +25,12 @@ const nodeinfo2 = async () => { activeHalfyear, activeMonth, localPosts, - localComments, ] = await Promise.all([ fetchMeta(true), Users.count({ where: { host: null } }), - Users.count({ where: { host: null, updatedAt: MoreThan(new Date(now - 15552000000)) } }), - Users.count({ where: { host: null, updatedAt: MoreThan(new Date(now - 2592000000)) } }), - Notes.count({ where: { userHost: null, replyId: null } }), - Notes.count({ where: { userHost: null, replyId: Not(IsNull()) } }), + Users.count({ where: { host: null, lastActiveDate: MoreThan(new Date(now - 15552000000)) } }), + Users.count({ where: { host: null, lastActiveDate: MoreThan(new Date(now - 2592000000)) } }), + Notes.count({ where: { userHost: null } }), ]); const proxyAccount = meta.proxyAccountId ? await Users.pack(meta.proxyAccountId).catch(() => null) : null; @@ -52,7 +50,7 @@ const nodeinfo2 = async () => { usage: { users: { total, activeHalfyear, activeMonth }, localPosts, - localComments, + localComments: 0, }, metadata: { nodeName: meta.name,