updateHashtagを並列で行わないように (#5284)
This commit is contained in:
@@ -9,7 +9,7 @@ import watch from './watch';
|
||||
import { parse } from '../../mfm/parse';
|
||||
import { resolveUser } from '../../remote/resolve-user';
|
||||
import config from '../../config';
|
||||
import { updateHashtag } from '../update-hashtag';
|
||||
import { updateHashtags } from '../update-hashtag';
|
||||
import { concat } from '../../prelude/array';
|
||||
import insertNoteUnread from './unread';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
@@ -202,7 +202,7 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
|
||||
}
|
||||
|
||||
// ハッシュタグ更新
|
||||
for (const tag of tags) updateHashtag(user, tag);
|
||||
updateHashtags(user, tags);
|
||||
|
||||
// Increment notes count (user)
|
||||
incNotesCountOfUser(user);
|
||||
|
||||
@@ -4,6 +4,22 @@ import { hashtagChart } from './chart';
|
||||
import { genId } from '../misc/gen-id';
|
||||
import { Hashtag } from '../models/entities/hashtag';
|
||||
|
||||
export async function updateHashtags(user: User, tags: string[]) {
|
||||
for (const tag of tags) {
|
||||
await updateHashtag(user, tag);
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateUsertags(user: User, tags: string[]) {
|
||||
for (const tag of tags) {
|
||||
await updateHashtag(user, tag, true, true);
|
||||
}
|
||||
|
||||
for (const tag of (user.tags || []).filter(x => !tags.includes(x))) {
|
||||
await updateHashtag(user, tag, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateHashtag(user: User, tag: string, isUserAttached = false, inc = true) {
|
||||
tag = tag.toLowerCase();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user