Skip to content

Commit 3f69a28

Browse files
authored
Fix retry loops with wait time to stop using 100% CPU. (#578)
1 parent ea8a8e9 commit 3f69a28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bin/pg_autoctl/service_postgres_ctl.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ service_postgres_ctl_loop(LocalPostgresServer *postgres)
284284
"see above for details.");
285285

286286
/* maybe next round will have better luck? */
287+
pg_usleep(100 * 1000); /* 100ms */
287288
continue;
288289
}
289290

@@ -322,6 +323,8 @@ service_postgres_ctl_loop(LocalPostgresServer *postgres)
322323
{
323324
*pgSetup = newPgSetup;
324325
}
326+
327+
pg_usleep(100 * 1000); /* 100ms */
325328
continue;
326329
}
327330

@@ -343,6 +346,7 @@ service_postgres_ctl_loop(LocalPostgresServer *postgres)
343346
if (!keeper_postgres_state_read(pgStatus, filename))
344347
{
345348
/* errors have already been logged, will try again */
349+
pg_usleep(100 * 1000); /* 100ms */
346350
continue;
347351
}
348352

0 commit comments

Comments
 (0)