From 7093573f0ccc5bb4b674aca34757cdeb5dd74548 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 3 Jan 2023 08:48:00 +0900 Subject: [PATCH] drop latestRequestSentAt of instance --- locales/ja-JP.yml | 1 - .../1672703171386-remove-latestRequestSentAt.js | 11 +++++++++++ .../src/core/entities/InstanceEntityService.ts | 3 +-- packages/backend/src/models/entities/Instance.ts | 8 -------- .../src/models/schema/federation-instance.ts | 5 ----- .../queue/processors/DeliverProcessorService.ts | 14 ++++++-------- packages/frontend/src/pages/instance-info.vue | 4 ---- 7 files changed, 18 insertions(+), 28 deletions(-) create mode 100644 packages/backend/migration/1672703171386-remove-latestRequestSentAt.js diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index eb30eed53a..d6a5518196 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -167,7 +167,6 @@ annotation: "注釈" federation: "連合" instances: "インスタンス" registeredAt: "初観測" -latestRequestSentAt: "直近のリクエスト送信" latestRequestReceivedAt: "直近のリクエスト受信" latestStatus: "直近のステータス" storageUsage: "ストレージ使用量" diff --git a/packages/backend/migration/1672703171386-remove-latestRequestSentAt.js b/packages/backend/migration/1672703171386-remove-latestRequestSentAt.js new file mode 100644 index 0000000000..c9b28dd7e1 --- /dev/null +++ b/packages/backend/migration/1672703171386-remove-latestRequestSentAt.js @@ -0,0 +1,11 @@ +export class removeLatestRequestSentAt1672703171386 { + name = 'removeLatestRequestSentAt1672703171386' + + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" DROP COLUMN "latestRequestSentAt"`); + } + + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "instance" ADD "latestRequestSentAt" TIMESTAMP WITH TIME ZONE`); + } +} diff --git a/packages/backend/src/core/entities/InstanceEntityService.ts b/packages/backend/src/core/entities/InstanceEntityService.ts index 5a7ceb89a3..7742608b07 100644 --- a/packages/backend/src/core/entities/InstanceEntityService.ts +++ b/packages/backend/src/core/entities/InstanceEntityService.ts @@ -7,8 +7,8 @@ import type { } from '@/models/entities/Blocking.js'; import type { User } from '@/models/entities/User.js'; import type { Instance } from '@/models/entities/Instance.js'; import { MetaService } from '@/core/MetaService.js'; -import { UserEntityService } from './UserEntityService.js'; import { bindThis } from '@/decorators.js'; +import { UserEntityService } from './UserEntityService.js'; @Injectable() export class InstanceEntityService { @@ -33,7 +33,6 @@ export class InstanceEntityService { notesCount: instance.notesCount, followingCount: instance.followingCount, followersCount: instance.followersCount, - latestRequestSentAt: instance.latestRequestSentAt ? instance.latestRequestSentAt.toISOString() : null, lastCommunicatedAt: instance.lastCommunicatedAt.toISOString(), isNotResponding: instance.isNotResponding, isSuspended: instance.isSuspended, diff --git a/packages/backend/src/models/entities/Instance.ts b/packages/backend/src/models/entities/Instance.ts index 7ea9234384..e4e9835ce8 100644 --- a/packages/backend/src/models/entities/Instance.ts +++ b/packages/backend/src/models/entities/Instance.ts @@ -59,14 +59,6 @@ export class Instance { }) public followersCount: number; - /** - * 直近のリクエスト送信日時 - */ - @Column('timestamp with time zone', { - nullable: true, - }) - public latestRequestSentAt: Date | null; - /** * 直近のリクエスト送信時のHTTPステータスコード */ diff --git a/packages/backend/src/models/schema/federation-instance.ts b/packages/backend/src/models/schema/federation-instance.ts index c57b3fec19..739548103a 100644 --- a/packages/backend/src/models/schema/federation-instance.ts +++ b/packages/backend/src/models/schema/federation-instance.ts @@ -32,11 +32,6 @@ export const packedFederationInstanceSchema = { type: 'number', optional: false, nullable: false, }, - latestRequestSentAt: { - type: 'string', - optional: false, nullable: true, - format: 'date-time', - }, lastCommunicatedAt: { type: 'string', optional: false, nullable: false, diff --git a/packages/backend/src/queue/processors/DeliverProcessorService.ts b/packages/backend/src/queue/processors/DeliverProcessorService.ts index 58969d550e..0e74260386 100644 --- a/packages/backend/src/queue/processors/DeliverProcessorService.ts +++ b/packages/backend/src/queue/processors/DeliverProcessorService.ts @@ -15,10 +15,10 @@ import ApRequestChart from '@/core/chart/charts/ap-request.js'; import FederationChart from '@/core/chart/charts/federation.js'; import { StatusError } from '@/misc/status-error.js'; import { UtilityService } from '@/core/UtilityService.js'; +import { bindThis } from '@/decorators.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; import type Bull from 'bull'; import type { DeliverJobData } from '../types.js'; -import { bindThis } from '@/decorators.js'; @Injectable() export class DeliverProcessorService { @@ -85,7 +85,6 @@ export class DeliverProcessorService { // Update stats this.federatedInstanceService.registerOrFetchInstanceDoc(host).then(i => { this.instancesRepository.update(i.id, { - latestRequestSentAt: new Date(), latestStatus: 200, lastCommunicatedAt: new Date(), isNotResponding: false, @@ -100,10 +99,9 @@ export class DeliverProcessorService { return 'Success'; } catch (res) { - // Update stats + // Update stats this.federatedInstanceService.registerOrFetchInstanceDoc(host).then(i => { this.instancesRepository.update(i.id, { - latestRequestSentAt: new Date(), latestStatus: res instanceof StatusError ? res.statusCode : null, isNotResponding: true, }); @@ -114,17 +112,17 @@ export class DeliverProcessorService { }); if (res instanceof StatusError) { - // 4xx + // 4xx if (res.isClientError) { - // HTTPステータスコード4xxはクライアントエラーであり、それはつまり - // 何回再送しても成功することはないということなのでエラーにはしないでおく + // HTTPステータスコード4xxはクライアントエラーであり、それはつまり + // 何回再送しても成功することはないということなのでエラーにはしないでおく return `${res.statusCode} ${res.statusMessage}`; } // 5xx etc. throw `${res.statusCode} ${res.statusMessage}`; } else { - // DNS error, socket error, timeout ... + // DNS error, socket error, timeout ... throw res; } } diff --git a/packages/frontend/src/pages/instance-info.vue b/packages/frontend/src/pages/instance-info.vue index f750fdcee2..23705cb22d 100644 --- a/packages/frontend/src/pages/instance-info.vue +++ b/packages/frontend/src/pages/instance-info.vue @@ -40,10 +40,6 @@ - - - -