my.fbmessenger.android: exclude unsent messages to avoid duplication

This commit is contained in:
Dima Gerasimov 2024-09-21 23:18:50 +01:00 committed by karlicoss
parent 6a18f47c37
commit 2ca323da84

View file

@ -168,6 +168,15 @@ def _process_db_msys(db: sqlite3.Connection) -> Iterator[Res[Entity]]:
CAST(sender_id AS TEXT) AS sender_id,
reply_source_id
FROM messages
WHERE
/* Regular message_id conforms to mid.* regex.
However seems that when message is not sent yet it doesn't have this server id yet
(happened only once, but could be just luck of course!)
We exclude these messages to avoid duplication.
However poisitive filter (e.g. message_id LIKE 'mid%') feels a bit wrong, e.g. what if mesage ids change or something
So instead this excludes only such unsent messages.
*/
message_id != offline_threading_id
ORDER BY timestamp_ms /* they aren't in order in the database, so need to sort */
'''
):