summaryrefslogtreecommitdiff
path: root/src/queue/processors/deliver.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/queue/processors/deliver.ts')
-rw-r--r--src/queue/processors/deliver.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/queue/processors/deliver.ts b/src/queue/processors/deliver.ts
index 373e57cbd5..3c61896a2f 100644
--- a/src/queue/processors/deliver.ts
+++ b/src/queue/processors/deliver.ts
@@ -11,6 +11,7 @@ import { toPuny } from '@/misc/convert-host';
import { Cache } from '@/misc/cache';
import { Instance } from '@/models/entities/instance';
import { DeliverJobData } from '../types';
+import { StatusError } from '@/misc/fetch';
const logger = new Logger('deliver');
@@ -68,16 +69,16 @@ export default async (job: Bull.Job<DeliverJobData>) => {
registerOrFetchInstanceDoc(host).then(i => {
Instances.update(i.id, {
latestRequestSentAt: new Date(),
- latestStatus: res != null && res.hasOwnProperty('statusCode') ? res.statusCode : null,
+ latestStatus: res instanceof StatusError ? res.statusCode : null,
isNotResponding: true
});
instanceChart.requestSent(i.host, false);
});
- if (res != null && res.hasOwnProperty('statusCode')) {
+ if (res instanceof StatusError) {
// 4xx
- if (res.statusCode >= 400 && res.statusCode < 500) {
+ if (res.isClientError) {
// HTTPステータスコード4xxはクライアントエラーであり、それはつまり
// 何回再送しても成功することはないということなのでエラーにはしないでおく
return `${res.statusCode} ${res.statusMessage}`;