def get_accounts_active(self): fuzzed = False count = AccountsActiveBySR.get_count(self) key = 'get_accounts_active-' + self._id36 # Fuzz counts having low values, for privacy reasons if count < 100 and not c.user_is_admin: fuzzed = True cached_count = g.cache.get(key) if not cached_count: # decay constant is e**(-x / 60) decay = math.exp(float(-count) / 60) jitter = round(5 * decay) count = count + random.randint(0, jitter) g.cache.set(key, count, time=5 * 60) else: count = cached_count return count, fuzzed
def get_accounts_active(self): fuzzed = False count = AccountsActiveBySR.get_count(self) key = "get_accounts_active-" + self._id36 # Fuzz counts having low values, for privacy reasons if count < 100 and not c.user_is_admin: fuzzed = True cached_count = g.cache.get(key) if not cached_count: # decay constant is e**(-x / 60) decay = math.exp(float(-count) / 60) jitter = round(5 * decay) count = count + random.randint(0, jitter) g.cache.set(key, count, time=5 * 60) else: count = cached_count return count, fuzzed
def accounts_active(self): return AccountsActiveBySR.get_count(self)