feat: 回答遅延問題対応(#40) #41

マージ済み
みてるぞ が 3 個のコミットを feature/040 から main へマージ 2026-01-03 13:23:33 +09:00
コミット 1c61d90662 の変更だけを表示してゐます - すべてのコミットを表示
+5 -1
ファイルの表示
@@ -63,6 +63,7 @@ def main (
waiting_balloon = (False, '', '')
last_flags_poll: float = 0
traced_af_ids: list[int] = []
while True:
now_m = time.monotonic ()
@@ -77,13 +78,14 @@ def main (
deerjika.talk (waiting_balloon[1], waiting_balloon[2])
waiting_balloon = (False, '', '')
if now_m - last_flags_poll >= 10:
if now_m - last_flags_poll >= 1:
last_flags_poll = now_m
log (f"balloon: { balloon.enabled }, snack: { snack_time.enabled }")
try:
DB.begin_transaction ()
answer_flags = (AnsweredFlag.where ('platform', Platform.YOUTUBE.value)
.where ('answered', False)
.where_not_in ('id', traced_af_ids)
.get ())
log (f"pending: { len (answer_flags) }")
if answer_flags:
@@ -102,6 +104,8 @@ def main (
waiting_balloon = (True, query.content, answer.content)
answer_flag.answered = True
answer_flag.save ()
case _:
traced_af_ids.append (answer_flag.id)
DB.commit ()
except Exception as ex:
DB.rollback ()