Revert "add timer for bot crawl that appears in debug log"

This reverts commit f4edfba532.
This commit is contained in:
Egg 2024-10-09 16:55:09 +02:00
parent a0dc703708
commit 34dffbb218

View file

@ -5,7 +5,7 @@ from config import config
from db import db from db import db
import logging import logging
from sendmail import sendmail from sendmail import sendmail
from time import sleep, time from time import sleep
def shutdown(): def shutdown():
try: try:
@ -33,16 +33,10 @@ if __name__ == '__main__':
try: try:
while True: while True:
sleep(15) # rest 15 seconds between each crawl run sleep(15) # rest 15 seconds between each crawl run
timer_all = time()
user_count = 0
for user in db.active_users: for user in db.active_users:
sleep(1) sleep(2)
user_count += 1
for bot in bots: for bot in bots:
timer_crawl = time()
reports = bot.crawl(user) reports = bot.crawl(user)
logger.debug("Crawl using bot %s took %f seconds" % (bot, time()-timer_crawl))
for status in reports: for status in reports:
if not user.is_appropriate(status): if not user.is_appropriate(status):
logger.info("Inaproppriate message: %d %s %s" % (user.uid, status.author, status.text)) logger.info("Inaproppriate message: %d %s %s" % (user.uid, status.author, status.text))
@ -50,7 +44,6 @@ if __name__ == '__main__':
for bot2 in bots: for bot2 in bots:
bot2.post(user, status) bot2.post(user, status)
logger.info("Resent: %d %s %s" % (user.uid, status.author, status.text)) 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: except Exception:
logger.error("Shutdown.", exc_info=True) logger.error("Shutdown.", exc_info=True)
shutdown() shutdown()