summaryrefslogtreecommitdiff
path: root/src/queue/processors
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2019-03-09 10:09:12 +0900
committersyuilo <syuilotan@yahoo.co.jp>2019-03-09 10:09:12 +0900
commita179cfd69affdc38e3f16f5d60375498538db289 (patch)
treec845560c842caa5eb244d79d587d10cc487f7799 /src/queue/processors
parentRename (diff)
parentTo retry AP deliver queue (#4457) (diff)
downloadsharkey-a179cfd69affdc38e3f16f5d60375498538db289.tar.gz
sharkey-a179cfd69affdc38e3f16f5d60375498538db289.tar.bz2
sharkey-a179cfd69affdc38e3f16f5d60375498538db289.zip
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
Diffstat (limited to 'src/queue/processors')
-rw-r--r--src/queue/processors/deliver.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/queue/processors/deliver.ts b/src/queue/processors/deliver.ts
index b561f33181..4cb1cfc6bb 100644
--- a/src/queue/processors/deliver.ts
+++ b/src/queue/processors/deliver.ts
@@ -7,7 +7,7 @@ import instanceChart from '../../services/chart/instance';
let latest: string = null;
-export default async (job: Bull.Job): Promise<void> => {
+export default async (job: Bull.Job) => {
const { host } = new URL(job.data.to);
try {
@@ -29,6 +29,8 @@ export default async (job: Bull.Job): Promise<void> => {
instanceChart.requestSent(i.host, true);
});
+
+ return 'Success';
} catch (res) {
// Update stats
registerOrFetchInstanceDoc(host).then(i => {
@@ -46,15 +48,19 @@ export default async (job: Bull.Job): Promise<void> => {
if (res != null && res.hasOwnProperty('statusCode')) {
queueLogger.warn(`deliver failed: ${res.statusCode} ${res.statusMessage} to=${job.data.to}`);
+ // 4xx
if (res.statusCode >= 400 && res.statusCode < 500) {
// HTTPステータスコード4xxはクライアントエラーであり、それはつまり
// 何回再送しても成功することはないということなのでエラーにはしないでおく
- return;
+ return `${res.statusCode} ${res.statusMessage}`;
}
- return res.statusMessage;
+ // 5xx etc.
+ throw `${res.statusCode} ${res.statusMessage}`;
} else {
+ // DNS error, socket error, timeout ...
queueLogger.warn(`deliver failed: ${res} to=${job.data.to}`);
+ throw res;
}
}
};