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:
2024-06-30 18:39:55 +00:00
parent 2caacd27a6
commit 9f0263bd28

View File

@@ -2,6 +2,7 @@ import logging
import os.path
import sqlite3
from datetime import datetime
from functools import lru_cache
from typing import Optional
from ..base import ResolverBase
@@ -121,6 +122,7 @@ class CellIdResolver(ResolverBase):
now, netd['created'] * 1e6, netd['updated'] * 1e6, netd['samples']),
}
@lru_cache
async def resolve_cell(self, radio, opc, lac, cid, **kwargs) -> Optional[dict]:
best_match = self._resolve_cell(radio, opc, lac, cid, self.search_network)
if best_match is None: