From 6170d1f77c63f3c1a2385b79be0f22bec4f1f24f Mon Sep 17 00:00:00 2001 From: Ibrar Ahmed Date: Mon, 12 Oct 2020 17:45:37 +0000 Subject: [PATCH] Issue - (#51): postgres process is taking too much CPU. Jira: PG-141 --- pg_stat_monitor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 630f9a9..581cdd9 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -2329,14 +2329,15 @@ wait_event_main(Datum main_arg) BackgroundWorkerUnblockSignals(); while (1) { - if (sigterm) - break; + sleep(1); + if (sigterm) + break; rc = WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, 1, PG_WAIT_EXTENSION); if (rc & WL_POSTMASTER_DEATH) - proc_exit(1); + proc_exit(1); - ResetLatch(&MyProc->procLatch); + ResetLatch(&MyProc->procLatch); update_wait_event(); }