controlsd: avoid lag on first iteration due to get_short_branch (#25031)

* controlsd: avoid lag on first iteration due to get_short_branch

* always cache
old-commit-hash: d4cc13c88a
taco
Willem Melching 3 years ago committed by GitHub
parent fe538c2f99
commit 297a0bd65b
  1. 4
      selfdrive/controls/controlsd.py
  2. 2
      selfdrive/controls/lib/events.py

@ -12,6 +12,7 @@ import cereal.messaging as messaging
from common.conversions import Conversions as CV
from panda import ALTERNATIVE_EXPERIENCE
from system.swaglog import cloudlog
from system.version import get_short_branch
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can
from selfdrive.controls.lib.lane_planner import CAMERA_OFFSET
@ -62,6 +63,9 @@ class Controls:
def __init__(self, sm=None, pm=None, can_sock=None, CI=None):
config_realtime_process(4, Priority.CTRL_HIGH)
# Ensure the current branch is cached, otherwise the first iteration of controlsd lags
self.branch = get_short_branch("")
# Setup sockets
self.pm = pm
if self.pm is None:

@ -222,7 +222,7 @@ def user_soft_disable_alert(alert_text_2: str) -> AlertCallbackType:
return func
def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
branch = get_short_branch("")
branch = get_short_branch("") # Ensure get_short_branch is cached to avoid lags on startup
if "REPLAY" in os.environ:
branch = "replay"

Loading…
Cancel
Save