Issue - (#51): postgres process is taking too much CPU.

Jira: PG-141
pull/55/head
Ibrar Ahmed 2020-10-12 17:45:37 +00:00
parent 0e67d5d68d
commit 6170d1f77c
1 changed files with 5 additions and 4 deletions

View File

@ -2329,14 +2329,15 @@ wait_event_main(Datum main_arg)
BackgroundWorkerUnblockSignals(); BackgroundWorkerUnblockSignals();
while (1) while (1)
{ {
if (sigterm) sleep(1);
break; if (sigterm)
break;
rc = WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, 1, PG_WAIT_EXTENSION); rc = WaitLatch(&MyProc->procLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, 1, PG_WAIT_EXTENSION);
if (rc & WL_POSTMASTER_DEATH) if (rc & WL_POSTMASTER_DEATH)
proc_exit(1); proc_exit(1);
ResetLatch(&MyProc->procLatch); ResetLatch(&MyProc->procLatch);
update_wait_event(); update_wait_event();
} }