Background gvfs restart to avoid blocking user.slice thaw
The post-sleep hook runs before systemd thaws user.slice, so a synchronous systemctl --user restart hangs for ~90 seconds waiting for the frozen user manager to respond — blocking the entire resume. Background the restart with a short delay so it executes after user.slice is thawed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a89c4f849d
commit
e490ca7d78
@@ -14,6 +14,10 @@ if [[ $1 == "pre" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 == "post" ]]; then
|
if [[ $1 == "post" ]]; then
|
||||||
|
# Run in background — user.slice is still frozen at this point, so a
|
||||||
|
# synchronous restart would block the thaw for up to 90 seconds.
|
||||||
|
(
|
||||||
|
sleep 5
|
||||||
for uid_dir in /run/user/*; do
|
for uid_dir in /run/user/*; do
|
||||||
uid=$(basename "$uid_dir")
|
uid=$(basename "$uid_dir")
|
||||||
if [[ -S $uid_dir/bus ]]; then
|
if [[ -S $uid_dir/bus ]]; then
|
||||||
@@ -23,4 +27,5 @@ if [[ $1 == "post" ]]; then
|
|||||||
systemctl --user restart gvfs-daemon.service 2>/dev/null || true
|
systemctl --user restart gvfs-daemon.service 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
) &
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user