diff options
-rw-r--r-- | cgi/post.py | 6 | ||||
-rwxr-xr-x | cgi/weabot.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/cgi/post.py b/cgi/post.py index cb531dd..741bebb 100644 --- a/cgi/post.py +++ b/cgi/post.py @@ -831,7 +831,8 @@ def trimThreads(): alert_time = int(round(board['maxage'] * Settings.MAX_AGE_ALERT)) time_limit = t + (alert_time * 86400) old_ops = FetchAll("SELECT `id`, `timestamp`, `expires`, `expires_alert`, `length` FROM `posts` WHERE `boardid` = %s AND `parentid` = 0 AND IS_DELETED = 0 AND `expires` > 0 AND `expires` < %s LIMIT 50", (board['id'], time_limit)) - + logging.debug("Old OPs 1: " + repr(old_ops)) + for op in old_ops: if t >= op['expires']: # Trim old threads @@ -851,6 +852,7 @@ def trimThreads(): oldest_last = t - (board['maxinactive'] * 86400) old_ops = FetchAll("SELECT `id`, `length` FROM `posts` WHERE `boardid` = %s AND `parentid` = 0 AND IS_DELETED = 0 AND `last` < %s LIMIT 50", (board['id'], oldest_last)) + logging.debug("Old OPs 2: " + repr(old_ops)) for op in old_ops: if board['archive'] and op["length"] >= Settings.ARCHIVE_MIN_LENGTH: @@ -878,6 +880,7 @@ def trimThreads(): op_posts = FetchAll("SELECT `id`, `length` FROM `posts` WHERE `boardid` = %s AND `parentid` = 0 AND IS_DELETED = 0 ORDER BY %s" % (board["id"], order)) if len(op_posts) > limit: posts = op_posts[limit:] + logging.debug("Old OPs 3: " + repr(posts)) for post in posts: if board['archive'] and op["length"] >= Settings.ARCHIVE_MIN_LENGTH: archiveThread(post["id"]) @@ -889,6 +892,7 @@ def trimThreads(): if archived: regenerateKako() + logging.debug("Trimmed threads: " + repr(trimmed)) return trimmed def autoclose_thread(parentid, t, replies): diff --git a/cgi/weabot.py b/cgi/weabot.py index ff3c9d3..85656d2 100755 --- a/cgi/weabot.py +++ b/cgi/weabot.py @@ -35,7 +35,7 @@ class weabot(object): def __init__(self, environ, start_response): global _DEBUG - logging.basicConfig(filename='weabot.log', format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO) + logging.basicConfig(filename='weabot.log', format='%(asctime)s %(levelname)s %(message)s', level=logging.DEBUG) self.environ = environ if self.environ["PATH_INFO"].startswith("/weabot.py/"): |