mirror of
https://github.com/simon987/chan_feed.git
synced 2025-04-18 01:36:44 +00:00
Bug fixes, routing key change
This commit is contained in:
parent
87fa735e7f
commit
2890222c4d
@ -4,7 +4,8 @@ LINK_RE = re.compile(r"(https?://[\w\-_.]+\.[a-z]{2,4}([^\s<'\"]*|$))")
|
|||||||
|
|
||||||
|
|
||||||
def post_process(thing, board, helper):
|
def post_process(thing, board, helper):
|
||||||
thing["v"] = 1.0
|
thing["v"] = 1.1
|
||||||
|
thing["_id"] = int(thing["no"])
|
||||||
|
|
||||||
thing["board"] = board
|
thing["board"] = board
|
||||||
thing["chan"] = helper.db_id
|
thing["chan"] = helper.db_id
|
||||||
|
8
run.py
8
run.py
@ -14,7 +14,7 @@ from chan import CHANS
|
|||||||
from post_process import post_process
|
from post_process import post_process
|
||||||
from util import logger, Web
|
from util import logger, Web
|
||||||
|
|
||||||
MONITORING = True
|
MONITORING = False
|
||||||
|
|
||||||
|
|
||||||
class ChanScanner:
|
class ChanScanner:
|
||||||
@ -106,7 +106,7 @@ class ChanState:
|
|||||||
return cur.fetchone() is not None
|
return cur.fetchone() is not None
|
||||||
|
|
||||||
def has_new_posts(self, thread, helper):
|
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 = conn.cursor()
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"SELECT last_modified FROM threads WHERE thread=? AND chan=?",
|
"SELECT last_modified FROM threads WHERE thread=? AND chan=?",
|
||||||
@ -118,7 +118,7 @@ class ChanState:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def mark_thread_as_visited(self, thread, helper):
|
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(
|
conn.execute(
|
||||||
"INSERT INTO threads (thread, last_modified, chan) "
|
"INSERT INTO threads (thread, last_modified, chan) "
|
||||||
"VALUES (?,?,?) "
|
"VALUES (?,?,?) "
|
||||||
@ -149,7 +149,7 @@ def publish(item, board, helper):
|
|||||||
|
|
||||||
chan_channel.basic_publish(
|
chan_channel.basic_publish(
|
||||||
exchange='chan',
|
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)
|
body=json.dumps(item)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user