Skip to content

Commit dc9ea7a

Browse files
committed
typo/fix retry logic; spotted by Philipp
1 parent f5dd61f commit dc9ea7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

table_postgres.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ table_postgres_query(const char *key, int service)
334334
log_warnx("warn: table-postgres: trying to reconnect after error: %s",
335335
PQerrorMessage(config->db));
336336
PQclear(res);
337-
if (config_connect(config) && --retries > 0)
337+
if (config_connect(config) && retries-- > 0)
338338
goto retry;
339339
if (retries <= 0)
340340
log_warnx("warn: table-postgres: too many retries");
@@ -473,7 +473,7 @@ table_postgres_fetch(int service, struct dict *params, char *dst, size_t sz)
473473
if (errfld == NULL || (errfld[0] == '0' && errfld[1] == '8')) {
474474
log_warnx("warn: trying to reconnect after error: %s", PQerrorMessage(config->db));
475475
PQclear(res);
476-
if (config_connect(config) && --retries > 0)
476+
if (config_connect(config) && retries-- > 0)
477477
goto retry;
478478
if (retries <= 0)
479479
log_warnx("warn: table-postgres: too many retries");

0 commit comments

Comments
 (0)