Class RateLimitUtils


  • public class RateLimitUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long rateLimitWrites()
      Rate limit writes in case indexes are lagging behind too far.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • rateLimitWrites

        public static long rateLimitWrites()
        Rate limit writes in case indexes are lagging behind too far. The method returns immediately if all async indexes are up-to-date (updated in the last 30 seconds). If indexing lanes are lagging behind, however, the method will wait (using Thread.sleep) for at most 1 minute. If the method is called more than once per minute, it will sleep for at most the time that passed until the last call; that is, an application that is calling it a lot will be paused for up to 50%. This assumes indexes will be able to catch up in this situation.
        Returns:
        the number of milliseconds the call was sleeping