Philipp Hörist pushed to branch master at gajim / gajim
Commits:
f55750ca by lovetox at 2022-01-12T22:44:03+01:00
Cache: Force JID objects
- - - - -
1 changed file:
- gajim/common/storage/cache.py
Changes:
=====================================
gajim/common/storage/cache.py
=====================================
@@ -17,7 +17,6 @@
from typing import Any
from typing import NamedTuple
from typing import Optional
-from typing import Union
import json
import time
@@ -101,7 +100,7 @@ def __init__(self):
CACHE_SQL_STATEMENT)
self._entity_caps_cache: dict[tuple[str, str], DiscoInfo] = {}
- self._disco_info_cache: dict[Union[JID, str], DiscoInfo] = {}
+ self._disco_info_cache: dict[JID, DiscoInfo] = {}
self._muc_cache: dict[JID, dict[str, Any]] = defaultdict(dict)
self._contact_cache: dict[JID, dict[str, Any]] = defaultdict(dict)
@@ -181,7 +180,7 @@ def _clean_caps_table(self) -> None:
@timeit
def _fill_disco_info_cache(self) -> None:
sql = '''SELECT disco_info as "disco_info [disco_info]",
- jid, last_seen FROM
+ jid as "jid [jid]", last_seen FROM
last_seen_disco_info'''
rows = self._con.execute(sql).fetchall()
for row in rows:
@@ -190,7 +189,7 @@ def _fill_disco_info_cache(self) -> None:
log.info('%d DiscoInfo entries loaded', len(rows))
def get_last_disco_info(self,
- jid: Union[str, JID],
+ jid: JID,
max_age: int = 0) -> Optional[DiscoInfo]:
"""
Get last disco info from jid
@@ -210,7 +209,7 @@ def get_last_disco_info(self,
@timeit
def set_last_disco_info(self,
- jid: Union[str, JID],
+ jid: JID,
disco_info: DiscoInfo,
cache_only: bool = False) -> None:
"""
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f55750ca581db312ba5aeb6750332dd1ed73ae66
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f55750ca581db312ba5aeb6750332dd1ed73ae66
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits