Fix md5 dedup check, add debug message when a post is being added to the database
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -86,7 +86,6 @@ async def pull():
|
|||||||
# Try to create post in database
|
# Try to create post in database
|
||||||
try:
|
try:
|
||||||
with db:
|
with db:
|
||||||
|
|
||||||
# Check the last N bans for the given board. If the following columns are equal:
|
# Check the last N bans for the given board. If the following columns are equal:
|
||||||
# * now
|
# * now
|
||||||
# * time
|
# * time
|
||||||
@@ -102,16 +101,23 @@ async def pull():
|
|||||||
where
|
where
|
||||||
now = :now
|
now = :now
|
||||||
and time = :time
|
and time = :time
|
||||||
and md5 = :md5
|
and (md5 = :md5 or md5 is null)
|
||||||
and com = :com
|
and com = :com
|
||||||
and sub = :sub
|
and sub = :sub
|
||||||
and board = :board
|
and board = :board
|
||||||
""",
|
""",
|
||||||
post,
|
post,
|
||||||
)
|
)
|
||||||
if _row := result.fetchone():
|
if row := result.fetchone():
|
||||||
log.debug("duplicate found, skipping - %s", _row["id"])
|
log.debug("duplicate found, skipping - %s", row["id"])
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
log.debug(
|
||||||
|
"adding post from %s with creation time %s and ban time %s",
|
||||||
|
post["board"],
|
||||||
|
post["time"],
|
||||||
|
post["now"],
|
||||||
|
)
|
||||||
|
|
||||||
post["action"] = cols["action"]
|
post["action"] = cols["action"]
|
||||||
# post['board'] = cols['board']
|
# post['board'] = cols['board']
|
||||||
|
|||||||
Reference in New Issue
Block a user