fix: never discard from _processing_uids to prevent re-fetching
This commit is contained in:
5
main.py
5
main.py
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user