diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c
new file mode 100644
index 292bed5..8719da9
*** a/src/backend/storage/ipc/standby.c
--- b/src/backend/storage/ipc/standby.c
*************** WaitExceedsMaxStandbyDelay(void)
*** 165,184 ****
  	ltime = GetStandbyLimitTime();
  	if (ltime && GetCurrentTimestamp() >= ltime)
  		return true;
- 
- 	/*
- 	 * Sleep a bit (this is essential to avoid busy-waiting).
- 	 */
- 	pg_usleep(standbyWait_us);
- 
- 	/*
- 	 * Progressively increase the sleep times, but not to more than 1s, since
- 	 * pg_usleep isn't interruptable on some platforms.
- 	 */
- 	standbyWait_us *= 2;
- 	if (standbyWait_us > 1000000)
- 		standbyWait_us = 1000000;
- 
  	return false;
  }
  
--- 165,170 ----
*************** ResolveRecoveryConflictWithVirtualXIDs(V
*** 247,252 ****
--- 233,253 ----
  				if (pid != 0)
  					pg_usleep(5000L);
  			}
+ 			else 
+ 			{
+ 				/*
+ 				 * Sleep a bit (this is essential to avoid busy-waiting).
+ 				 */
+ 				pg_usleep(standbyWait_us);
+ 
+ 				/*
+ 				 * Progressively increase the sleep times, but not to more than 1s, since
+ 				 * pg_usleep isn't interruptable on some platforms.
+ 				 */
+ 				standbyWait_us *= 2;
+ 				if (standbyWait_us > 1000000)
+ 					standbyWait_us = 1000000;
+ 			}
  		}
  
  		/* The virtual transaction is gone now, wait for the next one */
*************** ResolveRecoveryConflictWithLock(Oid dbOi
*** 357,363 ****
  	 */
  	while (!lock_acquired)
  	{
! 		if (++num_attempts < 3)
  			backends = GetLockConflicts(&locktag, AccessExclusiveLock);
  		else
  			backends = GetConflictingVirtualXIDs(InvalidTransactionId,
--- 358,364 ----
  	 */
  	while (!lock_acquired)
  	{
! 		if (num_attempts < 2)
  			backends = GetLockConflicts(&locktag, AccessExclusiveLock);
  		else
  			backends = GetConflictingVirtualXIDs(InvalidTransactionId,
*************** ResolveRecoveryConflictWithLock(Oid dbOi
*** 369,374 ****
--- 370,378 ----
  		if (LockAcquireExtended(&locktag, AccessExclusiveLock, true, true, false)
  			!= LOCKACQUIRE_NOT_AVAIL)
  			lock_acquired = true;
+ 
+ 		if (WaitExceedsMaxStandbyDelay()) 
+ 			num_attempts++;
  	}
  }
  
