From ef657b6d607fbfd69e67f6de7ef757a9c10374b2 Mon Sep 17 00:00:00 2001 From: Chuck Date: Wed, 20 Sep 2023 21:38:33 -0700 Subject: [PATCH] Skip multiple autojanny comment error --- files/helpers/offsitementions.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/files/helpers/offsitementions.py b/files/helpers/offsitementions.py index 114322dd8..42f477a05 100644 --- a/files/helpers/offsitementions.py +++ b/files/helpers/offsitementions.py @@ -84,11 +84,16 @@ def notify_mentions(mentions, send_to=None, mention_str='site mention'): ) g.db.flush() - existing_comment = g.db.query(Comment.id).filter_by( - author_id=const.AUTOJANNY_ID, - parent_post=None, - body_html=notif_text).one_or_none() - if existing_comment: break + try: + existing_comment = g.db.query(Comment.id).filter_by( + author_id=const.AUTOJANNY_ID, + parent_post=None, + body_html=notif_text).one_or_none() + if existing_comment: break + # todo: handle this exception by removing one of the existing + # means that multiple rows were found, happens on new install for some reason + except: + pass new_comment = Comment( author_id=const.AUTOJANNY_ID,