refactor: use sortedSetsCard

This commit is contained in:
Barış Soner Uşaklı
2025-04-11 19:51:18 -04:00
parent 4cee37b98e
commit 46ed56cf96

View File

@@ -58,11 +58,8 @@ module.exports = function (User) {
]);
}
const [followingCount, followingRemoteCount, followerCount, followerRemoteCount] = await Promise.all([
db.sortedSetCard(`following:${uid}`),
db.sortedSetCard(`followingRemote:${uid}`),
db.sortedSetCard(`followers:${theiruid}`),
db.sortedSetCard(`followersRemote:${theiruid}`),
const [followingCount, followingRemoteCount, followerCount, followerRemoteCount] = await db.sortedSetsCard([
`following:${uid}`, `followingRemote:${uid}`, `followers:${theiruid}`, `followersRemote:${theiruid}`
]);
await Promise.all([
User.setUserField(uid, 'followingCount', followingCount + followingRemoteCount),