From f4db8304ecc56adc99439770ce3c42b47a4c25fe Mon Sep 17 00:00:00 2001 From: liuzhanfeng2 Date: Wed, 18 Sep 2024 20:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=BC=82=E5=B8=B8=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=EF=BC=8Cgs=5Fctl=20stop=E7=AD=89=E5=BE=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/pg_ctl/pg_ctl.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bin/pg_ctl/pg_ctl.cpp b/src/bin/pg_ctl/pg_ctl.cpp index 079d68892..09352384c 100755 --- a/src/bin/pg_ctl/pg_ctl.cpp +++ b/src/bin/pg_ctl/pg_ctl.cpp @@ -1905,12 +1905,11 @@ static void do_stop(bool force) print_msg(_("waiting for server to shut down...")); for (cnt = 0; cnt < wait_seconds; cnt++) { - if (((pid = get_pgpid()) != 0) || - (postmaster_is_alive((pid_t)tpid) && IsMyPostmasterPid((pid_t)tpid, pg_config))) { - print_msg("."); - pg_usleep(1000000); /* 1 sec */ - } else + if (!(postmaster_is_alive((pid_t)tpid) && IsMyPostmasterPid((pid_t)tpid, pg_config))) break; + + print_msg("."); + pg_usleep(1000000); } if ((pid = get_pgpid()) != 0) { /* pid file still exists */