mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
Improve instance stats
This commit is contained in:
parent
dfb69030df
commit
e5841a2c9a
2 changed files with 18 additions and 2 deletions
|
@ -44,12 +44,17 @@ export interface IInstance {
|
|||
followersCount: number;
|
||||
|
||||
/**
|
||||
* 最近の通信日時
|
||||
* 直近のリクエスト送信日時
|
||||
*/
|
||||
latestRequestSentAt?: Date;
|
||||
|
||||
/**
|
||||
* 最近の通信のHTTPステータス
|
||||
* 直近のリクエスト送信時のHTTPステータスコード
|
||||
*/
|
||||
latestStatus?: number;
|
||||
|
||||
/**
|
||||
* 直近のリクエスト受信日時
|
||||
*/
|
||||
latestRequestReceivedAt?: Date;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue