mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-21 21:45:20 +02:00
feat: report Docker pull progress and add an idle timeout
A pull now reports docker.image.pull notifications on the controller stream: started, throttled downloading events with the layer counts and the latest daemon message, then completed or failed. An optional progress_id is echoed in every event so a client can correlate them with its own request. Image operations belong to a compute, not to a project, so the events go to the controller stream and reach clients that have no project open. The pull also has an idle socket read timeout of 60 seconds. Without it an unreachable registry left the pull, the compute request and the client request hanging forever with no feedback at all. The timeout is idle time, not total time: the daemon streams progress during the whole pull, so a minute without data means the registry is gone. When it fires, the daemon connection closes and Docker cancels the pull. Docker.http_query now accepts an aiohttp ClientTimeout object so a caller can ask for a policy finer than a total timeout.
This commit is contained in:
9 files changed
+266
-27
No files matched your search
@@ -119,6 +119,34 @@ async def test_dispatch_node_updated(controller, node, project):
|
||||
assert event["properties"]["startup_config"] == "ip 192"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_dispatch_docker_image_routed_to_controller_stream(controller, project):
|
||||
"""
|
||||
docker.image.* events are scoped to a compute, not to a project: they must
|
||||
reach the controller stream even when no project is open, and not the
|
||||
project stream.
|
||||
"""
|
||||
|
||||
notif = controller.notification
|
||||
with notif.controller_queue() as controller_q, notif.project_queue(project.id) as project_q:
|
||||
await controller_q.get(0.1) # ping
|
||||
await project_q.get(0.1) # ping
|
||||
|
||||
await notif.dispatch(
|
||||
"docker.image.pull", {"image": "debian", "state": "started"}, project_id=None, compute_id="local"
|
||||
)
|
||||
|
||||
msg = await controller_q.get(5)
|
||||
assert msg == (
|
||||
"docker.image.pull",
|
||||
{"image": "debian", "state": "started", "compute_id": "local"},
|
||||
{},
|
||||
)
|
||||
# the project stream only carries its periodic ping
|
||||
msg = await project_q.get(0.2)
|
||||
assert msg[0] == "ping"
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_dispatch_marker_routed_to_marker_channel(controller, project):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user