Skip to content

Commit d79e373

Browse files
author
Maksim Milyutin
committed
Increase waiting timeout under backend polling
1 parent 7159978 commit d79e373

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

contrib/pg_query_state/pg_query_state.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ PG_MODULE_MAGIC;
3636
#define PG_QS_MODULE_KEY 0xCA94B108
3737
#define PG_QUERY_STATE_KEY 0
3838

39+
#define MIN_TIMEOUT 5000
40+
3941
#define TEXT_CSTR_CMP(text, cstr) \
4042
(memcmp(VARDATA(text), (cstr), VARSIZE(text) - VARHDRSZ))
4143

@@ -847,7 +849,9 @@ GetRemoteBackendWorkers(PGPROC *proc)
847849
return NIL;
848850

849851
mqh = shm_mq_attach(mq, NULL, NULL);
850-
mq_receive_result = shm_mq_receive_with_timeout(mqh, &msg_len, (void **) &msg, 1000);
852+
mq_receive_result = shm_mq_receive_with_timeout(mqh, &msg_len,
853+
(void **) &msg,
854+
MIN_TIMEOUT);
851855
if (mq_receive_result != SHM_MQ_SUCCESS)
852856
return NIL;
853857

@@ -943,7 +947,7 @@ GetRemoteBackendQueryStates(List *procs,
943947
mq_receive_result = shm_mq_receive_with_timeout(mqh,
944948
&len,
945949
(void **) &msg,
946-
5000);
950+
MIN_TIMEOUT);
947951
if (mq_receive_result != SHM_MQ_SUCCESS)
948952
/* counterpart is died, not consider it */
949953
continue;

0 commit comments

Comments
 (0)