fix: 没有打开首页时不再安排学习状态推送
This commit is contained in:
@@ -73,3 +73,20 @@ def test_close_account_drops_open_socket() -> None:
|
||||
assert "gone" not in study_push._clients
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
|
||||
def test_notify_without_a_socket_does_not_schedule_a_flush() -> None:
|
||||
async def main() -> None:
|
||||
study_push._pending.clear()
|
||||
study_push._inflight.clear()
|
||||
study_push._dirty.clear()
|
||||
study_push._urgent.clear()
|
||||
study_push._clients.clear()
|
||||
study_push.attach_loop(asyncio.get_running_loop())
|
||||
study_push.notify("nobody")
|
||||
await asyncio.sleep(0)
|
||||
assert study_push._pending == {}
|
||||
assert study_push._inflight == set()
|
||||
assert "nobody" not in study_push._dirty
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user