private void maybeSleepAfterReplication(boolean allCaughtUp) {
    long sleepDurationMs = 0;
    if (allCaughtUp && replicationConfig.replicationReplicaThreadIdleSleepDurationMs > 0) {
      sleepDurationMs = replicationConfig.replicationReplicaThreadIdleSleepDurationMs;
      idleCount.inc();
    } else if (threadThrottleDurationMs > 0) {
      sleepDurationMs = threadThrottleDurationMs;
      throttleCount.inc();
    }

    if (running && sleepDurationMs > 0) {
      try {
        long currentTime = time.milliseconds();
        time.sleep(sleepDurationMs);
        logger.trace("Replica thread: {} slept for {} ms", threadName, time.milliseconds() - currentTime);
      } catch (InterruptedException e) {
        logger.error("Received interrupted exception during throttling", e);
      }
    }
  }
Maybe sleep for a while after one round of replication. If all the replicas are caught up and the configuration
shows we should sleep, then sleep for a while so we can save some CPU.
@param allCaughtUp True when all replicas are caught up.
ambry-replication/src/main/java/com/github/ambry/replication/ReplicaThread.java