Wait for nested container graceful shutdown (#8969)

This commit is contained in:
Tim O'Farrell 2025-06-08 13:43:34 -06:00 committed by GitHub
parent 617445d5ca
commit 0221f21c12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -295,6 +295,14 @@ class DockerNestedConversationManager(ConversationManager):
) as client:
response = await client.post(f'{nested_url}/api/conversations/{sid}/stop')
response.raise_for_status()
# Check up to 3 times that client has closed
for _ in range(3):
response = await client.get(f'{nested_url}/api/conversations/{sid}')
if response.status_code == status.HTTP_200_OK and response.json().get('status') == "STOPPED":
break
await asyncio.sleep(1)
except Exception:
logger.exception("error_stopping_container")
container.stop()