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:
|
||||
with db:
|
||||
|
||||
# Check the last N bans for the given board. If the following columns are equal:
|
||||
# * now
|
||||
# * time
|
||||
@@ -102,16 +101,23 @@ async def pull():
|
||||
where
|
||||
now = :now
|
||||
and time = :time
|
||||
and md5 = :md5
|
||||
and (md5 = :md5 or md5 is null)
|
||||
and com = :com
|
||||
and sub = :sub
|
||||
and board = :board
|
||||
""",
|
||||
post,
|
||||
)
|
||||
if _row := result.fetchone():
|
||||
log.debug("duplicate found, skipping - %s", _row["id"])
|
||||
if row := result.fetchone():
|
||||
log.debug("duplicate found, skipping - %s", row["id"])
|
||||
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['board'] = cols['board']
|
||||
|
||||
Reference in New Issue
Block a user