From 18d5801553beaebb7575dee9a7122c375b3f2e17 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <dgustafsson@postgresql.org>
Date: Tue, 9 Apr 2024 17:58:25 +0200
Subject: [PATCH v1 1/3] Configure interactive instance to restart timer

Use the published API from BackgroundPsql for automatically restarting
the timer rather than manually reaching into it to achieve the same
thing.
---
 src/bin/psql/t/010_tab_completion.pl | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index b45c39f0f5..54be55ade3 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -77,8 +77,10 @@ close $FH;
 # for possible debugging purposes.
 my $historyfile = "${PostgreSQL::Test::Utils::log_path}/010_psql_history.txt";
 
-# fire up an interactive psql session
+# fire up an interactive psql session and configure it such that each query
+# restarts the timer
 my $h = $node->interactive_psql('postgres', history_file => $historyfile);
+$h->set_query_timer_restart();
 
 # Simple test case: type something and see if psql responds as expected
 sub check_completion
@@ -88,9 +90,6 @@ sub check_completion
 	# report test failures from caller location
 	local $Test::Builder::Level = $Test::Builder::Level + 1;
 
-	# restart per-command timer
-	$h->{timeout}->start($PostgreSQL::Test::Utils::timeout_default);
-
 	# send the data to be sent and wait for its result
 	my $out = $h->query_until($pattern, $send);
 	my $okay = ($out =~ $pattern && !$h->{timeout}->is_expired);
-- 
2.39.3 (Apple Git-146)

