mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 22:14:50 +00:00
Pyrofork: Storage: MongoStorage: Check if fragment usernames need to be updated
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
7fca0e87bb
commit
2900a03dc5
1 changed files with 2 additions and 0 deletions
|
|
@ -165,6 +165,8 @@ class MongoStorage(Storage):
|
||||||
{'peer_id': 1, 'last_update_on': 1})
|
{'peer_id': 1, 'last_update_on': 1})
|
||||||
if r2 is None:
|
if r2 is None:
|
||||||
raise KeyError(f"Username not found: {username}")
|
raise KeyError(f"Username not found: {username}")
|
||||||
|
if abs(time.time() - r2['last_update_on']) > self.USERNAME_TTL:
|
||||||
|
raise KeyError(f"Username expired: {username}")
|
||||||
r = await self._peer.find_one({'_id': r2['peer_id']},
|
r = await self._peer.find_one({'_id': r2['peer_id']},
|
||||||
{'_id': 1, 'access_hash': 1, 'type': 1, 'last_update_on': 1})
|
{'_id': 1, 'access_hash': 1, 'type': 1, 'last_update_on': 1})
|
||||||
if r is None:
|
if r is None:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue