fix: 没有打开首页时不再安排学习状态推送

This commit is contained in:
2026-11-16 17:44:51 +08:00
parent 8fe0e729ea
commit 2a3a23c3c9
2 changed files with 27 additions and 3 deletions
+10 -3
View File
@@ -91,13 +91,20 @@ def notify(employee_id: str | None = None, urgent: bool = False) -> None:
loop = _loop
if loop is None or not loop.is_running():
return
keys = [(employee_id or "").strip()] if employee_id else list(_clients)
for key in keys:
if key:
if employee_id is not None:
key = employee_id.strip()
if not key or not _clients.get(key):
return
loop.call_soon_threadsafe(_mark, key, urgent)
return
for key in list(_clients):
if key and _clients.get(key):
loop.call_soon_threadsafe(_mark, key, urgent)
def _mark(employee_id: str, urgent: bool) -> None:
if not _clients.get(employee_id):
return
_dirty.add(employee_id)
if urgent:
_urgent.add(employee_id)