fix issue that receive thread has no chance to send a feedback

This commit is contained in:
movead
2021-06-29 19:19:26 +08:00
parent 68cb4eb003
commit b062d77364
2 changed files with 3 additions and 3 deletions

View File

@ -709,10 +709,10 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const
if (standby_message_timeout_local) {
#ifdef HAVE_INT64_TIMESTAMP
timeout.tv_sec = CalculateCopyStreamSleeptime(local_now,
standby_message_timeout_local,
standby_message_timeout_local / 2,
last_status);
#else
timeout.tv_sec = last_status + standby_message_timeout_local - local_now - 1;
timeout.tv_sec = last_status + (standby_message_timeout_local / 2) - local_now - 1;
#endif
if (timeout.tv_sec <= 0)
timeout.tv_sec = 1; /* Always sleep at least 1 sec */

View File

@ -665,7 +665,7 @@ bool ReceiveXlogStream(PGconn* conn, XLogRecPtr startpos, uint32 timeline, const
FD_ZERO(&input_mask);
FD_SET(PQsocket(conn), &input_mask);
if (standby_message_timeout) {
timeout.tv_sec = last_status + standby_message_timeout - local_now - 1;
timeout.tv_sec = last_status + (standby_message_timeout / 2) - local_now - 1;
if (timeout.tv_sec <= 0)
timeout.tv_sec = 1; /* Always sleep at least 1 sec */
timeout.tv_usec = 0;