diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-02-07 16:05:29 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-02-07 16:05:29 +0900 |
| commit | 7275bc6d3b356f3aa8ff7aef92f5abf52a18a13e (patch) | |
| tree | be1da9c8198f48ff18403dfa9e2bc2a8501d9ab0 /src | |
| parent | Merge branch 'develop' of https://github.com/syuilo/misskey into develop (diff) | |
| download | sharkey-7275bc6d3b356f3aa8ff7aef92f5abf52a18a13e.tar.gz sharkey-7275bc6d3b356f3aa8ff7aef92f5abf52a18a13e.tar.bz2 sharkey-7275bc6d3b356f3aa8ff7aef92f5abf52a18a13e.zip | |
Improve instance stats
Diffstat (limited to 'src')
| -rw-r--r-- | src/models/instance.ts | 9 | ||||
| -rw-r--r-- | src/queue/processors/http/process-inbox.ts | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/models/instance.ts b/src/models/instance.ts index 7a94a0a041..904ed95dc0 100644 --- a/src/models/instance.ts +++ b/src/models/instance.ts @@ -44,12 +44,17 @@ export interface IInstance { followersCount: number; /** - * 最近の通信日時 + * 直近のリクエスト送信日時 */ latestRequestSentAt?: Date; /** - * 最近の通信のHTTPステータス + * 直近のリクエスト送信時のHTTPステータスコード */ latestStatus?: number; + + /** + * 直近のリクエスト受信日時 + */ + latestRequestReceivedAt?: Date; } diff --git a/src/queue/processors/http/process-inbox.ts b/src/queue/processors/http/process-inbox.ts index 3cc13cbdaa..d88f00a098 100644 --- a/src/queue/processors/http/process-inbox.ts +++ b/src/queue/processors/http/process-inbox.ts @@ -8,6 +8,8 @@ import { toUnicode } from 'punycode'; import { URL } from 'url'; import { publishApLogStream } from '../../../services/stream'; import Logger from '../../../misc/logger'; +import { registerOrFetchInstanceDoc } from '../../../services/register-or-fetch-instance-doc'; +import Instance from '../../../models/instance'; const logger = new Logger('inbox'); @@ -101,6 +103,15 @@ export default async (job: bq.Job, done: any): Promise<void> => { }); //#endregion + // Update stats + registerOrFetchInstanceDoc(user.host).then(i => { + Instance.update({ _id: i._id }, { + $set: { + latestRequestReceivedAt: new Date() + } + }); + }); + // アクティビティを処理 try { await perform(user, activity); |