Optimize updating call unread count

This commit is contained in:
Jamie Kyle 2024-08-22 11:12:25 -07:00 committed by GitHub
parent 67252866cf
commit c901708281
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 48 additions and 5 deletions

View file

@ -3624,7 +3624,7 @@ const FOUR_HOURS_IN_MS = sqlConstant(4 * 60 * 60 * 1000);
function getCallHistoryUnreadCount(db: ReadableDB): number {
const [query, params] = sql`
SELECT count(*) FROM messages
LEFT JOIN callsHistory ON callsHistory.callId = messages.callId
INNER JOIN callsHistory ON callsHistory.callId = messages.callId
WHERE messages.type IS 'call-history'
AND messages.seenStatus IS ${SEEN_STATUS_UNSEEN}
AND callsHistory.status IS ${CALL_STATUS_MISSED}