Retry wake repaint quickly
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
ci / test (push) Waiting to run
ci / fuzz-smoke (push) Waiting to run
ci / windows-client (push) Waiting to run
ci / package-release (linux-x86_64, ubuntu-latest) (push) Waiting to run
ci / package-release (macos-aarch64, macos-14) (push) Waiting to run
ci / package-release (macos-x86_64, macos-13) (push) Waiting to run
ci / package-release (windows-x86_64, windows-latest) (push) Waiting to run
ci / publish-gitea-release (push) Blocked by required conditions
ci / remote-bench (push) Waiting to run
This commit is contained in:
+24
-5
@@ -75,6 +75,7 @@ const POST_RECONNECT_STALE_INPUT_GRACE: Duration = Duration::from_secs(5);
|
||||
const FOCUS_REPAINT_COOLDOWN: Duration = Duration::from_secs(1);
|
||||
const ALT_SCREEN_IDLE_REPAINT_AFTER: Duration = Duration::from_secs(15);
|
||||
const LOCAL_SLEEP_REPAINT_AFTER: Duration = Duration::from_secs(5);
|
||||
const LOCAL_SLEEP_REPAINT_RETRY_AFTER: Duration = Duration::from_secs(1);
|
||||
|
||||
/// Sentinel `target_host` the server uses on a server-initiated `StreamOpen` that
|
||||
/// represents an SSH-agent connection (rather than a TCP target). The client
|
||||
@@ -7324,10 +7325,13 @@ fn should_repaint_idle_terminal(
|
||||
status_tick_gap: Duration,
|
||||
now: Instant,
|
||||
) -> bool {
|
||||
(alternate_screen
|
||||
&& now.duration_since(last_terminal_frame_at) >= ALT_SCREEN_IDLE_REPAINT_AFTER
|
||||
|| status_tick_gap >= LOCAL_SLEEP_REPAINT_AFTER)
|
||||
&& now.duration_since(last_attempt_at) >= ALT_SCREEN_IDLE_REPAINT_AFTER
|
||||
let sleep_wake_gap = status_tick_gap >= LOCAL_SLEEP_REPAINT_AFTER;
|
||||
let stale_alternate_screen = alternate_screen
|
||||
&& now.duration_since(last_terminal_frame_at) >= ALT_SCREEN_IDLE_REPAINT_AFTER;
|
||||
if sleep_wake_gap {
|
||||
return now.duration_since(last_attempt_at) >= LOCAL_SLEEP_REPAINT_RETRY_AFTER;
|
||||
}
|
||||
stale_alternate_screen && now.duration_since(last_attempt_at) >= ALT_SCREEN_IDLE_REPAINT_AFTER
|
||||
}
|
||||
|
||||
fn arm_stale_terminal_input_suppression(suppress_until: &mut Option<Instant>) {
|
||||
@@ -11376,6 +11380,7 @@ mod tests {
|
||||
let now = Instant::now();
|
||||
let stale = now - ALT_SCREEN_IDLE_REPAINT_AFTER - Duration::from_secs(1);
|
||||
let recent = now - Duration::from_secs(1);
|
||||
let just_attempted = now - Duration::from_millis(500);
|
||||
assert!(should_repaint_idle_terminal(
|
||||
true,
|
||||
stale,
|
||||
@@ -11390,6 +11395,20 @@ mod tests {
|
||||
LOCAL_SLEEP_REPAINT_AFTER + Duration::from_secs(1),
|
||||
now
|
||||
));
|
||||
assert!(should_repaint_idle_terminal(
|
||||
false,
|
||||
recent,
|
||||
recent,
|
||||
LOCAL_SLEEP_REPAINT_AFTER + Duration::from_secs(1),
|
||||
now
|
||||
));
|
||||
assert!(!should_repaint_idle_terminal(
|
||||
false,
|
||||
recent,
|
||||
just_attempted,
|
||||
LOCAL_SLEEP_REPAINT_AFTER + Duration::from_secs(1),
|
||||
now
|
||||
));
|
||||
assert!(!should_repaint_idle_terminal(
|
||||
false,
|
||||
stale,
|
||||
@@ -11404,7 +11423,7 @@ mod tests {
|
||||
Duration::from_secs(1),
|
||||
now
|
||||
));
|
||||
assert!(!should_repaint_idle_terminal(
|
||||
assert!(should_repaint_idle_terminal(
|
||||
true,
|
||||
stale,
|
||||
recent,
|
||||
|
||||
Reference in New Issue
Block a user