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 => { 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はクライアントエラーであり、それはつまり // 何回再送しても成功することはないということなのでエラーにはしないでおく diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 634c2e263d..9320889c2b 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -295,9 +295,11 @@ export default async (user: IUser, data: { nm.push(u._id, 'mention'); }); - mentionedUsers.filter(u => isRemoteUser(u)).forEach(async u => { - deliver(user, await render(), (u as IRemoteUser).inbox); - }); + if (isLocalUser(user)) { + mentionedUsers.filter(u => isRemoteUser(u)).forEach(async u => { + deliver(user, await render(), (u as IRemoteUser).inbox); + }); + } // Append mentions data if (mentionedUsers.length > 0) {