diff --git a/post_process.py b/post_process.py index 764b3b0..3450f18 100644 --- a/post_process.py +++ b/post_process.py @@ -4,7 +4,8 @@ LINK_RE = re.compile(r"(https?://[\w\-_.]+\.[a-z]{2,4}([^\s<'\"]*|$))") def post_process(thing, board, helper): - thing["v"] = 1.0 + thing["v"] = 1.1 + thing["_id"] = int(thing["no"]) thing["board"] = board thing["chan"] = helper.db_id diff --git a/run.py b/run.py index 7f26786..ada9639 100644 --- a/run.py +++ b/run.py @@ -14,7 +14,7 @@ from chan import CHANS from post_process import post_process from util import logger, Web -MONITORING = True +MONITORING = False class ChanScanner: @@ -106,7 +106,7 @@ class ChanState: return cur.fetchone() is not None def has_new_posts(self, thread, helper): - with sqlite3.connect(self._db) as conn: + with sqlite3.connect(self._db, timeout=5000) as conn: cur = conn.cursor() cur.execute( "SELECT last_modified FROM threads WHERE thread=? AND chan=?", @@ -118,7 +118,7 @@ class ChanState: return False def mark_thread_as_visited(self, thread, helper): - with sqlite3.connect(self._db) as conn: + with sqlite3.connect(self._db, timeout=5000) as conn: conn.execute( "INSERT INTO threads (thread, last_modified, chan) " "VALUES (?,?,?) " @@ -149,7 +149,7 @@ def publish(item, board, helper): chan_channel.basic_publish( exchange='chan', - routing_key="%d.%s.%s" % (helper.db_id, item_type, board), + routing_key="%s.%s.%s" % (chan, item_type, board), body=json.dumps(item) )