Philipp Hörist pushed to branch master at gajim / gajim


Commits:
ad562c9a by Philipp Hörist at 2024-07-17T22:14:49+02:00
fix: OMEMO: Don’t delete signed pre keys before catchup

This always keeps the last 3 signed pre keys in the database and
makes the cycling less aggressive

- - - - -


2 changed files:

- gajim/common/modules/omemo.py
- gajim/common/storage/omemo.py


Changes:

=====================================
gajim/common/modules/omemo.py
=====================================
@@ -133,7 +133,7 @@ def __init__(self, client: types.Client) -> None:
         omemo_config = OMEMOConfig(default_prekey_amount=100,
                                    min_prekey_amount=80,
                                    spk_archive_seconds=86400 * 15,
-                                   spk_cycle_seconds=86400,
+                                   spk_cycle_seconds=86400 * 30,
                                    unacknowledged_count=2000)
 
         self._backend = OMEMOSessionManager(


=====================================
gajim/common/storage/omemo.py
=====================================
@@ -402,7 +402,11 @@ def get_signed_pre_key_timestamp(self, signed_pre_key_id: 
int) -> int:
 
     def remove_old_signed_pre_keys(self, timestamp: int) -> None:
         query = '''DELETE FROM signed_prekeys
-                   WHERE timestamp < datetime(?, "unixepoch")'''
+                   WHERE prekey_id NOT IN (
+                    SELECT prekey_id FROM signed_prekeys
+                    ORDER BY timestamp desc LIMIT 3
+                   )'''
+
         self._con.execute(query, (timestamp,))
         self._con.commit()
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/ad562c9ae033805d914bcb6a286269db1c3c90b8

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/ad562c9ae033805d914bcb6a286269db1c3c90b8
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to