diff --git a/backend.py b/backend.py index 155da55..2fc9491 100755 --- a/backend.py +++ b/backend.py @@ -5,7 +5,7 @@ from config import config from db import db import logging from sendmail import sendmail -from time import sleep, time +from time import sleep def shutdown(): try: @@ -33,16 +33,10 @@ if __name__ == '__main__': try: while True: sleep(15) # rest 15 seconds between each crawl run - timer_all = time() - user_count = 0 for user in db.active_users: - sleep(1) - user_count += 1 - + sleep(2) for bot in bots: - timer_crawl = time() reports = bot.crawl(user) - logger.debug("Crawl using bot %s took %f seconds" % (bot, time()-timer_crawl)) for status in reports: if not user.is_appropriate(status): logger.info("Inaproppriate message: %d %s %s" % (user.uid, status.author, status.text)) @@ -50,7 +44,6 @@ if __name__ == '__main__': for bot2 in bots: bot2.post(user, status) logger.info("Resent: %d %s %s" % (user.uid, status.author, status.text)) - logger.debug("All %d users crawled and msgs resent in %f seconds" % (user_count, time()-timer_all)) except Exception: logger.error("Shutdown.", exc_info=True) shutdown()