From 8d3066264755f4c275a5fb1d52dbaf581188dd61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6borg?= Date: Thu, 2 Oct 2025 09:17:32 +0200 Subject: [PATCH 1/2] fix: remove this import as it causes python to treat "json" as a variable in the except block --- deploy/docker/api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/deploy/docker/api.py b/deploy/docker/api.py index 78a36bf3..d0127e7b 100644 --- a/deploy/docker/api.py +++ b/deploy/docker/api.py @@ -563,7 +563,6 @@ async def handle_crawl_request( if isinstance(hook_manager, UserHookManager): try: # Ensure all hook data is JSON serializable - import json hook_data = { "status": hooks_status, "execution_log": hook_manager.execution_log, From 35dd206925e2e189e2338e654a55ed4a3cd2d918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6borg?= Date: Thu, 2 Oct 2025 09:20:59 +0200 Subject: [PATCH 2/2] fix: always return a list, even if we catch an exception --- crawl4ai/async_dispatcher.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crawl4ai/async_dispatcher.py b/crawl4ai/async_dispatcher.py index 5bb1a47c..bd44557c 100644 --- a/crawl4ai/async_dispatcher.py +++ b/crawl4ai/async_dispatcher.py @@ -455,8 +455,6 @@ class MemoryAdaptiveDispatcher(BaseDispatcher): # Update priorities for waiting tasks if needed await self._update_queue_priorities() - - return results except Exception as e: if self.monitor: @@ -467,6 +465,7 @@ class MemoryAdaptiveDispatcher(BaseDispatcher): memory_monitor.cancel() if self.monitor: self.monitor.stop() + return results async def _update_queue_priorities(self): """Periodically update priorities of items in the queue to prevent starvation"""