summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NotificationService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-04-05 10:21:10 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-04-05 10:21:10 +0900
commitf44504097c360fc84179161abee47b79a936b455 (patch)
treeaec17f0837ccad89754fae24c044ba0b8d7e8def /packages/backend/src/core/NotificationService.ts
parentenhance(backend): チャンネルの既読管理を削除 (diff)
downloadmisskey-f44504097c360fc84179161abee47b79a936b455.tar.gz
misskey-f44504097c360fc84179161abee47b79a936b455.tar.bz2
misskey-f44504097c360fc84179161abee47b79a936b455.zip
enhance(backend): improve cache
Diffstat (limited to 'packages/backend/src/core/NotificationService.ts')
-rw-r--r--packages/backend/src/core/NotificationService.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/backend/src/core/NotificationService.ts b/packages/backend/src/core/NotificationService.ts
index 9c179f9318..366dc08c02 100644
--- a/packages/backend/src/core/NotificationService.ts
+++ b/packages/backend/src/core/NotificationService.ts
@@ -73,7 +73,7 @@ export class NotificationService implements OnApplicationShutdown {
type: Notification['type'],
data: Partial<Notification>,
): Promise<Notification | null> {
- const profile = await this.cacheService.userProfileCache.fetch(notifieeId, () => this.userProfilesRepository.findOneByOrFail({ userId: notifieeId }));
+ const profile = await this.cacheService.userProfileCache.fetch(notifieeId);
const isMuted = profile.mutingNotificationTypes.includes(type);
if (isMuted) return null;
@@ -82,8 +82,8 @@ export class NotificationService implements OnApplicationShutdown {
return null;
}
- const mutings = await this.cacheService.userMutingsCache.fetch(notifieeId, () => this.mutingsRepository.findBy({ muterId: notifieeId }).then(xs => xs.map(x => x.muteeId)));
- if (mutings.includes(data.notifierId)) {
+ const mutings = await this.cacheService.userMutingsCache.fetch(notifieeId);
+ if (mutings.has(data.notifierId)) {
return null;
}
}