diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c new file mode 100644 index 9776858..3657a08 *** a/src/backend/replication/basebackup.c --- b/src/backend/replication/basebackup.c *************** throttle(size_t increment) *** 1348,1361 **** if (throttling_counter < throttling_sample) return; ! /* Time elapsed since the last measurement (and possible wake up). */ ! elapsed = GetCurrentTimestamp() - throttled_last; ! /* How much should have elapsed at minimum? */ ! elapsed_min = elapsed_min_unit * (throttling_counter / throttling_sample); ! sleep = elapsed_min - elapsed; ! /* Only sleep if the transfer is faster than it should be. */ ! if (sleep > 0) { ResetLatch(MyLatch); /* We're eating a potentially set latch, so check for interrupts */ --- 1348,1364 ---- if (throttling_counter < throttling_sample) return; ! for (;;) { + /* Time elapsed since the last measurement (and possible wake up). */ + elapsed = GetCurrentTimestamp() - throttled_last; + /* How much should have elapsed at minimum? */ + elapsed_min = elapsed_min_unit * (throttling_counter / throttling_sample); + sleep = elapsed_min - elapsed; + /* Only sleep if the transfer is faster than it should be. */ + if (sleep <= 0) + break; + ResetLatch(MyLatch); /* We're eating a potentially set latch, so check for interrupts */