From d65cb345bffafa3858a1e28e7f6ef3a8763ccd38 Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Thu, 25 Jun 2026 23:06:48 -0300 Subject: [PATCH] emustation: speed up "Restart EmulationStation" Reported as working but very slow (long black screen). Two OS-side contributors cut, the rest (ES gamelist re-scan) is inherent: - es_settings (ExecStartPre, runs on every ES start) unconditionally ran `systemctl restart tz-data.service` synchronously, blocking the relaunch. Only restart it when the timezone actually changed. - emustation.service RestartSec was 2s of dead time before the relaunch. Drop to 1s; StartLimitIntervalSec/StartLimitBurst already guard crash-loops. Co-Authored-By: Claude Opus 4.8 --- .../packages/ui/emulationstation/sources/es_settings | 9 ++++++++- .../ui/emulationstation/system.d/emustation.service | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/projects/ArchR/packages/ui/emulationstation/sources/es_settings b/projects/ArchR/packages/ui/emulationstation/sources/es_settings index 6dae2d01d6..7b7e36d23b 100755 --- a/projects/ArchR/packages/ui/emulationstation/sources/es_settings +++ b/projects/ArchR/packages/ui/emulationstation/sources/es_settings @@ -10,8 +10,15 @@ export SDL_AUDIODRIVER=pulseaudio TZ=$(get_setting system.timezone) echo -n "TIMEZONE=${TZ}" > /storage/.cache/timezone +# es_settings is ExecStartPre for emustation.service, so it runs on every ES +# (re)start. Restarting tz-data is synchronous and blocks the ES relaunch +# (a visible chunk of the "Restart EmulationStation" black screen), yet it +# only matters when the timezone changed. Skip it otherwise. +PREV_TZ="$(cat /storage/.cache/system_timezone 2>/dev/null)" echo -n "${TZ}" >/storage/.cache/system_timezone -systemctl restart tz-data.service +if [ "${TZ}" != "${PREV_TZ}" ]; then + systemctl restart tz-data.service +fi MYLOCALE=$(get_setting system.language) if [[ -n "${MYLOCALE}" ]] diff --git a/projects/ArchR/packages/ui/emulationstation/system.d/emustation.service b/projects/ArchR/packages/ui/emulationstation/system.d/emustation.service index baa977733e..e8cd50d74d 100644 --- a/projects/ArchR/packages/ui/emulationstation/system.d/emustation.service +++ b/projects/ArchR/packages/ui/emulationstation/system.d/emustation.service @@ -19,8 +19,12 @@ ExecStartPre=/usr/bin/es_settings ExecStart=/usr/bin/emulationstation --log-path /var/log --no-splash KillMode=process TimeoutStopSec=3 +# RestartSec is pure dead time on a user-initiated "Restart EmulationStation" +# (and after a crash). StartLimitIntervalSec/StartLimitBurst above already +# stop a crash-loop from flooding, so keep just enough debounce to avoid a +# tight loop. Restart=always -RestartSec=2 +RestartSec=1 [Install] WantedBy=archr.target