private void waitForIdentifyRateLimit ( ) { String token = api . getPrefixedToken ( ) ; connectionDelaySemaphorePerAccount . computeIfAbsent ( token , key -> new Semaphore ( 1 ) ) . acquireUninterruptibly ( ) ; for ( long delay = 5100 - ( System . currentTimeMillis ( ) - lastIdentificationPerAccount . getOrDefault ( token , 0L ) ) ; delay > 0 ; delay = 5100 - ( System . currentTimeMillis ( ) - lastIdentificationPerAccount . getOrDefault ( token , 0L ) ) ) { logger . debug ( "Delaying connecting by {}ms" , delay ) ; try { Thread . sleep ( delay ) ; } catch ( InterruptedException ignored ) { } } }
Identification is rate limited to once every 5 seconds so don t try to more often per account even in different instances . This method waits for the identification rate limit to be over then returns .