1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-29 07:18:52 +09:00
This commit is contained in:
syuilo 2018-05-07 18:20:15 +09:00
parent d305c7e401
commit 79640d6861
3 changed files with 8 additions and 4 deletions

View File

@ -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',

View File

@ -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はクライアントエラーであり、それはつまり
// 何回再送しても成功することはないということなのでエラーにはしないでおく

View File

@ -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) {