From cdd130b36df6e3cd5339e0573a81d534ba1b01da Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sun, 11 Sep 2022 01:48:05 +0300 Subject: [PATCH] Barebones fix again sqlite error: Recursive use of cursors not allowed. --- src/listener_mention.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/listener_mention.py b/src/listener_mention.py index 7f382b8..a4ede3f 100644 --- a/src/listener_mention.py +++ b/src/listener_mention.py @@ -8,6 +8,7 @@ from dateutil.parser import parse as dateutilparse from dateutil.relativedelta import relativedelta, TU, SU from loguru import logger +lock = threading.Lock() def get_control_mention(): while True: @@ -17,10 +18,12 @@ def get_control_mention(): if now_week not in (0, 6): time.sleep(30) continue - if get_state('last_thread_id'): + if now_week == 6 and now_hour <= fmn_next_watching_hour: # Предотвращение работы в холстую до начала сеанса time.sleep(30) continue - if now_week == 6 and now_hour <= fmn_next_watching_hour: # Предотвращение работы в холстую до начала сеанса + with lock: + post_exists = get_state('last_thread_id') + if post_exists: time.sleep(30) continue logger.debug('Wait for from admin mention...')