Fix bug
This commit is contained in:
parent
d305c7e401
commit
79640d6861
3 changed files with 8 additions and 4 deletions
|
@ -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',
|
||||
|
|
|
@ -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はクライアントエラーであり、それはつまり
|
||||
// 何回再送しても成功することはないということなのでエラーにはしないでおく
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue