File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -722,7 +722,13 @@ def determine_proxy_configuration(internal_camoufox_proxy_arg=None):
722722 MAX_CAMOUFOX_RETRIES = 3
723723 for camoufox_attempt in range (MAX_CAMOUFOX_RETRIES ):
724724 if camoufox_attempt > 0 :
725- logger .warning (f' 🔄 重试启动 Camoufox (第 { camoufox_attempt + 1 } /{ MAX_CAMOUFOX_RETRIES } 次)...' )
725+ # Use a different port to avoid EADDRINUSE from previous attempt
726+ retry_port = args .camoufox_debug_port + camoufox_attempt
727+ for i , arg in enumerate (camoufox_internal_cmd_args ):
728+ if arg == '--internal-camoufox-port' and i + 1 < len (camoufox_internal_cmd_args ):
729+ camoufox_internal_cmd_args [i + 1 ] = str (retry_port )
730+ break
731+ logger .warning (f' 🔄 重试启动 Camoufox (第 { camoufox_attempt + 1 } /{ MAX_CAMOUFOX_RETRIES } 次, 端口: { retry_port } )...' )
726732 camoufox_proc = subprocess .Popen (camoufox_internal_cmd_args , ** camoufox_popen_kwargs )
727733 logger .info (f' Camoufox 内部进程已启动 (PID: { camoufox_proc .pid } )。正在等待 WebSocket 端点输出 (最长 { ENDPOINT_CAPTURE_TIMEOUT } 秒)...' )
728734 camoufox_output_q = queue .Queue ()
You can’t perform that action at this time.
0 commit comments