summaryrefslogtreecommitdiff
path: root/src/queue
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-05-07 18:20:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-05-07 18:20:15 +0900
commit79640d686104a301abe40b20519375350699f971 (patch)
tree124e973c34adc60d999f5e86973f9650791954a5 /src/queue
parentFix (diff)
downloadsharkey-79640d686104a301abe40b20519375350699f971.tar.gz
sharkey-79640d686104a301abe40b20519375350699f971.tar.bz2
sharkey-79640d686104a301abe40b20519375350699f971.zip
Fix bug
Diffstat (limited to 'src/queue')
-rw-r--r--src/queue/index.ts3
-rw-r--r--src/queue/processors/http/deliver.ts1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/queue/index.ts b/src/queue/index.ts
index 32fd043f79..3f82b30b35 100644
--- a/src/queue/index.ts
+++ b/src/queue/index.ts
@@ -2,6 +2,7 @@ import { createQueue } from 'kue';
import config from '../config';
import http from './processors/http';
+import { ILocalUser } from '../models/user';
const queue = createQueue({
redis: {
@@ -20,7 +21,7 @@ export function createHttp(data) {
.backoff({ delay: 16384, type: 'exponential' });
}
-export function deliver(user, content, to) {
+export function deliver(user: ILocalUser, content, to) {
createHttp({
title: 'deliver',
type: 'deliver',
diff --git a/src/queue/processors/http/deliver.ts b/src/queue/processors/http/deliver.ts
index cf843fad07..0a228c1871 100644
--- a/src/queue/processors/http/deliver.ts
+++ b/src/queue/processors/http/deliver.ts
@@ -7,6 +7,7 @@ export default async (job: kue.Job, done): Promise<void> => {
await request(job.data.user, job.data.to, job.data.content);
done();
} catch (res) {
+ if (res.statusCode == null) return done();
if (res.statusCode >= 400 && res.statusCode < 500) {
// HTTPステータスコード4xxはクライアントエラーであり、それはつまり
// 何回再送しても成功することはないということなのでエラーにはしないでおく