From 0637844d55609b0cd8d28082fd56729648dae987 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 10 Apr 2025 19:31:14 +0500 Subject: [PATCH] bug fix: n8n revert --- plogical/DockerSites.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 68edba9ad..242a07bc7 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -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',