fix: treat DSM 599 as task-not-ready in _poll_task, poll until 60s timeout

DirSize/MD5 return error 599 while the async task is still initialising on
the NAS, not only after the task is gone. Remove the 5-consecutive-599 abort
limit and the debug stderr logging; instead pass on 599 and keep polling
until the existing 60 s timeout fires. Rename the test that checked the old
limit to reflect the new timeout-based behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 13:19:32 +02:00
parent c0d4c347c5
commit 4bf655236d
5 changed files with 10 additions and 32 deletions
+3 -2
View File
@@ -1635,8 +1635,8 @@ async def test_dir_size_retries_on_transient_599(config: AppConfig) -> None:
@pytest.mark.asyncio
async def test_dir_size_fails_after_5_consecutive_599(config: AppConfig) -> None:
"""dir_size gives up and returns Error: after 5 consecutive 599 responses."""
async def test_dir_size_times_out_on_persistent_599(config: AppConfig) -> None:
"""dir_size returns Error: after 60 s timeout when DSM keeps returning 599."""
client = MagicMock()
async def _request(api, method, version=None, params=None, **kwargs):
@@ -1651,6 +1651,7 @@ async def test_dir_size_fails_after_5_consecutive_599(config: AppConfig) -> None
result = await tools["dir_size"](path="/dead")
assert result.startswith("Error:")
assert "timed out" in result.lower() or "60 seconds" in result
# ──────────────────────────────────────────────────────────────────────────