Skip to content

Commit

Permalink
2squash: Optimize another SQL statement
Browse files Browse the repository at this point in the history
  • Loading branch information
iequidoo committed Nov 28, 2024
1 parent b35dc50 commit 27a1244
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3352,11 +3352,13 @@ pub async fn marknoticed_chat(context: &Context, chat_id: ChatId) -> Result<()>
.filter(|&(_, state)| state == MessageState::InFresh)
.map(|(id, _)| id);

// NB: Enumerate `hidden` values to employ `msgs_index7`.
let nr_msgs_noticed = conn.execute(
"UPDATE msgs
SET state=?
WHERE state=?
AND chat_id=?",
AND (hidden=0 OR hidden=1)
AND chat_id=?",
(MessageState::InNoticed, MessageState::InFresh, chat_id),
)?;
Ok((nr_msgs_noticed, id_to_markseen))
Expand Down

0 comments on commit 27a1244

Please sign in to comment.