From 4b6e77d6b3c1abb03976459491945fccf1c26c3d Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <dgustafsson@postgresql.org>
Date: Thu, 31 Oct 2024 13:18:51 +0100
Subject: [PATCH v2 1/2] 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.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/1100715.1712265845@sss.pgh.pa.us
---
 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 fd645896c9..2cdba15dc7 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)

