fix(security): add sleep to container wait loop (#12869)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nelson Spence
2026-03-18 12:04:36 -05:00
committed by GitHub
parent c62b47dcb1
commit 48cd85e47e

View File

@@ -6,6 +6,7 @@
# Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above.
# Tag: Legacy-V0
import re
import time
import uuid
from typing import Any
@@ -71,15 +72,16 @@ class InvariantAnalyzer(SecurityAnalyzer):
else:
self.container = running_containers[0]
elapsed = 0
start_time = time.time()
while self.container.status != 'running':
self.container = self.docker_client.containers.get(self.container_name)
elapsed += 1
elapsed = time.time() - start_time
logger.debug(
f'waiting for container to start: {elapsed}, container status: {self.container.status}'
f'waiting for container to start: {elapsed:.1f}s, container status: {self.container.status}'
)
if elapsed > self.timeout:
break
time.sleep(0.5)
self.api_port = int(
self.container.attrs['NetworkSettings']['Ports']['8000/tcp'][0]['HostPort']