import database import logging import traceback import time import config def update_statistics(): if not config.AI.enabled: return while True: try: database.update_statistics(config.AI.k) except Exception: logging.error('\n\t%s' % '\n\t'.join(traceback.format_exc().split('\n')).rstrip()) time.sleep(config.AI.update_frequency)