forked from ticketfrei/ticketfrei
add timer for bot crawl that appears in debug log
This commit is contained in:
parent
d7aea928d1
commit
f4edfba532
|
|
@ -5,7 +5,7 @@ from config import config
|
|||
from db import db
|
||||
import logging
|
||||
from sendmail import sendmail
|
||||
from time import sleep
|
||||
from time import sleep, time
|
||||
|
||||
def shutdown():
|
||||
try:
|
||||
|
|
@ -34,14 +34,16 @@ if __name__ == '__main__':
|
|||
while True:
|
||||
sleep(15) # rest 15 seconds between each crawl run
|
||||
for user in db.active_users:
|
||||
sleep(1)
|
||||
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))
|
||||
continue
|
||||
for bot2 in bots:
|
||||
sleep(1)
|
||||
bot2.post(user, status)
|
||||
logger.info("Resent: %d %s %s" % (user.uid, status.author, status.text))
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Reference in a new issue