mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 19:33:45 +08:00
Merge branch 'upstream/openpilot/master' into sync-20250731
# Conflicts: # .github/workflows/selfdrive_tests.yaml # common/params.h # common/params_keys.h # common/params_pyx.pyx # docs/CARS.md # opendbc_repo # panda # selfdrive/car/tests/test_models.py # selfdrive/pandad/pandad.cc # selfdrive/pandad/pandad.h # selfdrive/selfdrived/selfdrived.py # selfdrive/ui/translations/main_ar.ts # selfdrive/ui/translations/main_de.ts # selfdrive/ui/translations/main_es.ts # selfdrive/ui/translations/main_fr.ts # selfdrive/ui/translations/main_ja.ts # selfdrive/ui/translations/main_ko.ts # selfdrive/ui/translations/main_pt-BR.ts # selfdrive/ui/translations/main_th.ts # selfdrive/ui/translations/main_tr.ts # selfdrive/ui/translations/main_zh-CHS.ts # selfdrive/ui/translations/main_zh-CHT.ts # system/athena/athenad.py # system/athena/manage_athenad.py # system/manager/manager.py # system/sentry.py # uv.lock Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master` Sync: `commaai/panda:master` into `sunnypilot/panda:master`
This commit is contained in:
@@ -88,8 +88,8 @@ class ModelCache:
|
||||
def _is_expired(self) -> bool:
|
||||
"""Checks if the cache has expired"""
|
||||
current_time = int(time.monotonic() * 1e9)
|
||||
last_sync = int(self.params.get(self._LAST_SYNC_KEY, encoding="utf-8") or 0)
|
||||
return last_sync == 0 or (current_time - last_sync) >= self.cache_timeout
|
||||
last_sync = self.params.get(self._LAST_SYNC_KEY) or 0
|
||||
return bool(last_sync == 0) or (current_time - last_sync) >= self.cache_timeout
|
||||
|
||||
def get(self) -> tuple[dict, bool]:
|
||||
"""
|
||||
@@ -98,7 +98,7 @@ class ModelCache:
|
||||
If no cached data exists or on error, returns an empty dict
|
||||
"""
|
||||
try:
|
||||
cached_data = self.params.get(self._CACHE_KEY, encoding="utf-8")
|
||||
cached_data = self.params.get(self._CACHE_KEY)
|
||||
if not cached_data:
|
||||
cloudlog.warning("No cached model data available")
|
||||
return {}, True
|
||||
@@ -110,7 +110,7 @@ class ModelCache:
|
||||
def set(self, data: dict) -> None:
|
||||
"""Updates the cache with new model data"""
|
||||
self.params.put(self._CACHE_KEY, json.dumps(data))
|
||||
self.params.put(self._LAST_SYNC_KEY, str(int(time.monotonic() * 1e9)))
|
||||
self.params.put(self._LAST_SYNC_KEY, int(time.monotonic() * 1e9))
|
||||
|
||||
|
||||
class ModelFetcher:
|
||||
|
||||
Reference in New Issue
Block a user