def check_uuids(): num_changed = 0 offset = cache.get(COUNTER_CACHE_NAME) or 0 players = _get_players(offset) if not players: rollbar.report_message('All players checked, check_uuids wrapping around', level='info', extra_data={ 'offset': offset }) offset = 0 players = _get_players(offset) for player in players: try: changed = _handle_player(player) except (IntegrityError, OperationalError): db.session.rollback() rollbar.report_exc_info(level='warning', extra_data={ 'uuid': player.uuid }) else: if changed: num_changed += 1 cache.set(COUNTER_CACHE_NAME, offset + PLAYERS_PER_JOB, 86400) rollbar.report_message('Finished checking uuid group', level='info', extra_data={ 'offset': offset, 'num_changed': num_changed })
def decorator(*args, **kwargs): result = cache.get(self._cache_key(*args, **kwargs)) if not result: result = fn(*args, **kwargs) cache.set(self._cache_key(*args, **kwargs), result, self.time) return result