mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +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})
|
||||
if r2 is None:
|
||||
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']},
|
||||
{'_id': 1, 'access_hash': 1, 'type': 1, 'last_update_on': 1})
|
||||
if r is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue