fix: 默认心跳先等够再报,新登录账号可以立刻开始
This commit is contained in:
@@ -120,16 +120,15 @@ def test_wait_stop_timeout_and_event() -> None:
|
||||
asyncio.run(main())
|
||||
|
||||
|
||||
def test_jitter_zero_means_no_wait() -> None:
|
||||
assert _jitter(0) == 0
|
||||
assert _jitter(-1) == 0
|
||||
def test_jitter_never_sends_early() -> None:
|
||||
assert _jitter(0) == 1
|
||||
assert _jitter(-1) == 1
|
||||
for _ in range(30):
|
||||
wait = _jitter(1)
|
||||
assert 0 <= wait < 5
|
||||
assert abs(wait - 1) <= 0.3
|
||||
assert 1.3 <= wait <= 4
|
||||
for _ in range(30):
|
||||
wait = _jitter(10)
|
||||
assert 7 <= wait <= 13
|
||||
assert 10.3 <= wait <= 13.3
|
||||
|
||||
|
||||
def test_count_total_estimates_from_progress() -> None:
|
||||
@@ -322,6 +321,11 @@ class _VideoSession:
|
||||
def test_video_refresh_hours_when_finished(monkeypatch) -> None:
|
||||
monkeypatch.setattr("euniv.autostudy._update_month_hours", lambda *_args: None)
|
||||
|
||||
async def no_wait(*_args, **_kwargs) -> bool:
|
||||
return False
|
||||
|
||||
monkeypatch.setattr("euniv.autostudy._heartbeat_wait", no_wait)
|
||||
|
||||
async def main() -> None:
|
||||
session = _VideoSession("700")
|
||||
global_stop = asyncio.Event()
|
||||
|
||||
Reference in New Issue
Block a user