static void sleepIfWriterQueueLarge(int numberOfIndexingThreads) {
    var currentlySleeping = SLEEPING_INDEXERS.get();
    var couldBeSleeping = currentlySleeping + 1;
    int writesInQueueToSleep = MAX_ALLOWED_WRITES_IN_QUEUE_PER_INDEXER * (numberOfIndexingThreads + couldBeSleeping);
    var writesInQueue = INDEX_WRITES_QUEUED.get();
    //TODO RC: why we don't repeat the CAS below if it fails?
    if (writesInQueue > writesInQueueToSleep && SLEEPING_INDEXERS.compareAndSet(currentlySleeping, couldBeSleeping)) {
      var writesToWakeUp = writesInQueueToSleep - MAX_ALLOWED_WRITES_IN_QUEUE_PER_INDEXER;
      LOG.debug("Sleeping indexer: ", couldBeSleeping, " of ", numberOfIndexingThreads, "; writes queued: ", writesInQueue,
                "; wake up when queue shrinks to ", writesToWakeUp);
      var napTimeNs = MAX_ALLOWED_WRITES_IN_QUEUE_PER_INDEXER * EXPECTED_SINGLE_WRITE_TIME_NS;
      try {
        long slept = sleepUntilUpdatesQueueIsShrunk(writesToWakeUp, napTimeNs);
        LOG.debug("Waking indexer ", SLEEPING_INDEXERS.get(), " of ", numberOfIndexingThreads, " by ", INDEX_WRITES_QUEUED.get(),
                  " updates in queue, should have wake up on ", writesToWakeUp,
                  "; slept for ", slept, " ms");
      }
      finally {
        SLEEPING_INDEXERS.decrementAndGet();
      }
    }
  }
static void sleepIfWriterQueueLarge(int numberOfIndexingThreads)