mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-24 23:42:05 +08:00
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
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user