Bug fixes, routing key change

This commit is contained in:
simon987 2019-08-26 21:36:49 -04:00
parent 87fa735e7f
commit 2890222c4d
2 changed files with 6 additions and 5 deletions

View File

@ -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

8
run.py
View File

@ -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)
)