updateHashtagを並列で行わないように (#5284)

This commit is contained in:
MeiMei 2019-08-18 12:47:45 +09:00 committed by syuilo
parent fc78c75bab
commit 7ecfc007a9
4 changed files with 23 additions and 10 deletions

View file

@ -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();