cellidresolver: cache lookup results in memory
it can take literally 5s or more on moby to synthesize cell results. caching will hopefully help that.
This commit is contained in:
@@ -2,6 +2,7 @@ import logging
|
|||||||
import os.path
|
import os.path
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from functools import lru_cache
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from ..base import ResolverBase
|
from ..base import ResolverBase
|
||||||
@@ -121,6 +122,7 @@ class CellIdResolver(ResolverBase):
|
|||||||
now, netd['created'] * 1e6, netd['updated'] * 1e6, netd['samples']),
|
now, netd['created'] * 1e6, netd['updated'] * 1e6, netd['samples']),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
async def resolve_cell(self, radio, opc, lac, cid, **kwargs) -> Optional[dict]:
|
async def resolve_cell(self, radio, opc, lac, cid, **kwargs) -> Optional[dict]:
|
||||||
best_match = self._resolve_cell(radio, opc, lac, cid, self.search_network)
|
best_match = self._resolve_cell(radio, opc, lac, cid, self.search_network)
|
||||||
if best_match is None:
|
if best_match is None:
|
||||||
|
Reference in New Issue
Block a user