bug fix: n8n revert

This commit is contained in:
usmannasir
2025-04-10 19:31:14 +05:00
parent f61bf9776c
commit 0637844d55

View File

@@ -789,10 +789,10 @@ services:
##### N8N Container
def check_container_health(self, container_name, max_retries=3, delay=10):
return True
def check_container_health(self, container_name, max_retries=3, delay=80):
"""
Check if a container is healthy and running
Check if a container is running, accepting both healthy and unhealthy states
Total wait time will be 4 minutes (3 retries * 80 seconds)
"""
try:
for attempt in range(max_retries):
@@ -802,15 +802,16 @@ services:
if container.status == 'running':
health = container.attrs.get('State', {}).get('Health', {}).get('Status')
if health == 'healthy' or health is None:
# Accept both healthy and unhealthy states as long as container is running
if health in ['healthy', 'unhealthy'] or health is None:
return True
elif health == 'unhealthy':
else:
health_logs = container.attrs.get('State', {}).get('Health', {}).get('Log', [])
if health_logs:
last_log = health_logs[-1]
logging.writeToFile(f'Container health check failed: {last_log.get("Output", "")}')
logging.writeToFile(f'Container {container_name} not healthy, attempt {attempt + 1}/{max_retries}')
logging.writeToFile(f'Container {container_name} not running, attempt {attempt + 1}/{max_retries}')
time.sleep(delay)
return False
@@ -1220,7 +1221,7 @@ services:
'N8N_HOST': self.data['finalURL'],
'NODE_ENV': 'production',
'WEBHOOK_URL': f"https://{self.data['finalURL']}",
'N8N_PUSH_BACKEND': 'websocket',
'N8N_PUSH_BACKEND': 'sse',
'GENERIC_TIMEZONE': 'UTC',
'N8N_ENCRYPTION_KEY': 'auto',
'N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS': 'true',