throttling is once every 5 min for an error

This commit is contained in:
shaun 2016-11-02 07:08:33 +11:00
parent d7728afea0
commit 1554a52bf7
1 changed files with 2 additions and 2 deletions

View File

@ -133,13 +133,13 @@ class GoogleAnalytics():
def sendEventData(self, eventCategory, eventAction, eventLabel=None, throttle=False):
# if throttling is enabled then only log the same event every 60 seconds
# if throttling is enabled then only log the same event every 5 min
if(throttle):
throttleKey = eventCategory + "-" + eventAction + "-" + str(eventLabel)
lastLogged = logEventHistory.get(throttleKey)
if(lastLogged != None):
timeSinceLastLog = time.time() - lastLogged
if(timeSinceLastLog < 60):
if(timeSinceLastLog < 300):
log.info("SKIPPING_LOG_EVENT : " + str(timeSinceLastLog) + " " + throttleKey)
return
logEventHistory[throttleKey] = time.time()