diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-04-07 06:22:03 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-04-07 06:22:03 +0900 |
| commit | 66346495e56e07a5b167a8f94ed971f081c94e88 (patch) | |
| tree | a5de5b8fa258087f847fcb03afeaa4c743b67c76 /src/queue | |
| parent | Bug fixes and some refactors (diff) | |
| download | sharkey-66346495e56e07a5b167a8f94ed971f081c94e88.tar.gz sharkey-66346495e56e07a5b167a8f94ed971f081c94e88.tar.bz2 sharkey-66346495e56e07a5b167a8f94ed971f081c94e88.zip | |
Fix bug
Diffstat (limited to 'src/queue')
| -rw-r--r-- | src/queue/processors/http/deliver.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/queue/processors/http/deliver.ts b/src/queue/processors/http/deliver.ts index da7e8bc368..f5d162fd0c 100644 --- a/src/queue/processors/http/deliver.ts +++ b/src/queue/processors/http/deliver.ts @@ -6,9 +6,14 @@ export default async (job: kue.Job, done): Promise<void> => { try { await request(job.data.user, job.data.to, job.data.content); done(); - } catch (e) { - console.warn(`deliver failed: ${e}`); - - done(e); + } catch (res) { + if (res.statusCode >= 300 && res.statusCode < 400) { + // HTTPステータスコード4xxはクライアントエラーであり、それはつまり + // 何回再送しても成功することはないということなのでエラーにはしないでおく + done(); + } else { + console.warn(`deliver failed: ${res.statusMessage}`); + done(new Error(res.statusMessage)); + } } }; |