public boolean errorShouldBeSent ( final StackifyError error ) { if ( error == null ) { throw new NullPointerException ( "StackifyError is null" ) ; } boolean shouldBeProcessed = false ; long epochMinute = getUnixEpochMinutes ( ) ; synchronized ( errorCounter ) { // increment the counter for this error int errorCount = errorCounter . incrementCounter ( error , epochMinute ) ; // check our throttling criteria if ( errorCount <= MAX_DUP_ERROR_PER_MINUTE ) { shouldBeProcessed = true ; } // see if we need to purge our counters of expired entries if ( nextErrorToCounterCleanUp < epochMinute ) { errorCounter . purgeCounters ( epochMinute ) ; nextErrorToCounterCleanUp = epochMinute + CLEAN_UP_MINUTES ; } } return shouldBeProcessed ; }
Determines if the error should be sent based on our throttling criteria