diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-23 16:05:26 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-23 16:05:26 +0900 |
| commit | e4e668b32753b31d7162b979cd4e6d1a3a280b9f (patch) | |
| tree | 7d476b5588bafb34278fdfac560cf43ef64065fc | |
| parent | ダークモードのキーボードショートカット追加 (diff) | |
| download | sharkey-e4e668b32753b31d7162b979cd4e6d1a3a280b9f.tar.gz sharkey-e4e668b32753b31d7162b979cd4e6d1a3a280b9f.tar.bz2 sharkey-e4e668b32753b31d7162b979cd4e6d1a3a280b9f.zip | |
Improve performance
| -rw-r--r-- | src/services/note/read.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/services/note/read.ts b/src/services/note/read.ts index 46918bc38c..8622597bc0 100644 --- a/src/services/note/read.ts +++ b/src/services/note/read.ts @@ -20,11 +20,15 @@ export default ( : new mongo.ObjectID(note); // Remove document - await NoteUnread.remove({ + const res = await NoteUnread.remove({ userId: userId, noteId: noteId }); + if (res.deletedCount == 0) { + return; + } + const count1 = await NoteUnread .count({ userId: userId, |