mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 17:56:12 +01:00
bug fix: n8n reporting
This commit is contained in:
@@ -791,7 +791,7 @@ services:
|
|||||||
|
|
||||||
def check_container_health(self, container_name, max_retries=3, delay=80):
|
def check_container_health(self, container_name, max_retries=3, delay=80):
|
||||||
"""
|
"""
|
||||||
Check if a container is running, accepting both healthy and unhealthy states
|
Check if a container is running, accepting healthy, unhealthy, and starting states
|
||||||
Total wait time will be 4 minutes (3 retries * 80 seconds)
|
Total wait time will be 4 minutes (3 retries * 80 seconds)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
@@ -802,8 +802,9 @@ services:
|
|||||||
if container.status == 'running':
|
if container.status == 'running':
|
||||||
health = container.attrs.get('State', {}).get('Health', {}).get('Status')
|
health = container.attrs.get('State', {}).get('Health', {}).get('Status')
|
||||||
|
|
||||||
# Accept both healthy and unhealthy states as long as container is running
|
# Accept healthy, unhealthy, and starting states as long as container is running
|
||||||
if health in ['healthy', 'unhealthy'] or health is None:
|
if health in ['healthy', 'unhealthy', 'starting'] or health is None:
|
||||||
|
logging.writeToFile(f'Container {container_name} is running with status: {health}')
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
health_logs = container.attrs.get('State', {}).get('Health', {}).get('Log', [])
|
health_logs = container.attrs.get('State', {}).get('Health', {}).get('Log', [])
|
||||||
@@ -811,7 +812,7 @@ services:
|
|||||||
last_log = health_logs[-1]
|
last_log = health_logs[-1]
|
||||||
logging.writeToFile(f'Container health check failed: {last_log.get("Output", "")}')
|
logging.writeToFile(f'Container health check failed: {last_log.get("Output", "")}')
|
||||||
|
|
||||||
logging.writeToFile(f'Container {container_name} not running, attempt {attempt + 1}/{max_retries}')
|
logging.writeToFile(f'Container {container_name} status: {container.status}, health: {health}, attempt {attempt + 1}/{max_retries}')
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user