fix: remove blocking sleep from preexec hook causing command lag (#1444)
When socket connection mode is not 'off', the shell integration runs _cmux_stop_pr_poll_loop in the preexec hook before every command. This function had a blocking 'sleep 0.1' call that caused noticeable lag on every command execution. The fix replaces the TERM+sleep+KILL pattern with direct SIGKILL. The PR poll loop is a lightweight background process that only runs 'gh pr view' periodically - it's safe to kill abruptly without waiting for graceful termination. Fixes #1436 Co-authored-by: BillionClaw <267901332+BillionClaw@users.noreply.github.com>
This commit is contained in:
parent
07ec05b0f1
commit
5776cd5d81
2 changed files with 6 additions and 10 deletions
|
|
@ -263,11 +263,9 @@ _cmux_run_pr_probe_with_timeout() {
|
|||
|
||||
_cmux_stop_pr_poll_loop() {
|
||||
if [[ -n "$_CMUX_PR_POLL_PID" ]]; then
|
||||
_cmux_kill_process_tree "$_CMUX_PR_POLL_PID" TERM
|
||||
sleep 0.1
|
||||
if kill -0 "$_CMUX_PR_POLL_PID" >/dev/null 2>&1; then
|
||||
_cmux_kill_process_tree "$_CMUX_PR_POLL_PID" KILL
|
||||
fi
|
||||
# Use SIGKILL directly to avoid blocking sleep in preexec.
|
||||
# The poll loop is lightweight and safe to kill abruptly.
|
||||
_cmux_kill_process_tree "$_CMUX_PR_POLL_PID" KILL
|
||||
_CMUX_PR_POLL_PID=""
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,11 +288,9 @@ _cmux_run_pr_probe_with_timeout() {
|
|||
|
||||
_cmux_stop_pr_poll_loop() {
|
||||
if [[ -n "$_CMUX_PR_POLL_PID" ]]; then
|
||||
_cmux_kill_process_tree "$_CMUX_PR_POLL_PID" TERM
|
||||
sleep 0.1
|
||||
if kill -0 "$_CMUX_PR_POLL_PID" >/dev/null 2>&1; then
|
||||
_cmux_kill_process_tree "$_CMUX_PR_POLL_PID" KILL
|
||||
fi
|
||||
# Use SIGKILL directly to avoid blocking sleep in preexec.
|
||||
# The poll loop is lightweight and safe to kill abruptly.
|
||||
_cmux_kill_process_tree "$_CMUX_PR_POLL_PID" KILL
|
||||
_CMUX_PR_POLL_PID=""
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue