perf(server): Reduce database query
This commit is contained in:
parent
9e6cdd6106
commit
e881e1bfb3
@ -259,21 +259,21 @@ export default async (user: User, data: Option, silent = false) => new Promise<N
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Antenna
|
// Antenna
|
||||||
Antennas.find().then(async antennas => {
|
Followings.createQueryBuilder('following')
|
||||||
const followings = await Followings.createQueryBuilder('following')
|
.andWhere(`following.followeeId = :userId`, { userId: note.userId })
|
||||||
.andWhere(`following.followeeId = :userId`, { userId: note.userId })
|
.getMany()
|
||||||
.getMany();
|
.then(followings => {
|
||||||
|
const followers = followings.map(f => f.followerId);
|
||||||
const followers = followings.map(f => f.followerId);
|
Antennas.find().then(async antennas => {
|
||||||
|
for (const antenna of antennas) {
|
||||||
for (const antenna of antennas) {
|
checkHitAntenna(antenna, note, user, followers).then(hit => {
|
||||||
checkHitAntenna(antenna, note, user, followers).then(hit => {
|
if (hit) {
|
||||||
if (hit) {
|
addNoteToAntenna(antenna, note, user);
|
||||||
addNoteToAntenna(antenna, note, user);
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Channel
|
// Channel
|
||||||
if (note.channelId) {
|
if (note.channelId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user