fix: never discard from _processing_uids to prevent re-fetching

This commit is contained in:
2026-07-13 07:49:09 +08:00
parent 155a6dfc53
commit 0ec2048bc5

View File

@@ -110,19 +110,16 @@ def _tg_worker(cfg):
try: try:
info = _tg_queue.get_nowait() info = _tg_queue.get_nowait()
tg_send_and_mark(cfg, info) tg_send_and_mark(cfg, info)
# 发送并标记已读成功后移除 pending # 发送并标记已读成功后移除 pending_processing_uids 保留直到重启)
with _pending_lock: with _pending_lock:
_pending_uids.discard(info["uid"]) _pending_uids.discard(info["uid"])
_processing_uids.discard(info["uid"])
except queue_module.Empty: except queue_module.Empty:
break break
except Exception as e: except Exception as e:
logger.error(f"TG 发送失败: {e}", exc_info=True) logger.error(f"TG 发送失败: {e}", exc_info=True)
# 发送失败也要移除 pending避免永久阻塞
try: try:
with _pending_lock: with _pending_lock:
_pending_uids.discard(info["uid"]) _pending_uids.discard(info["uid"])
_processing_uids.discard(info["uid"])
except Exception: except Exception:
pass pass