Skip to content

Commit e03ca00

Browse files
committed
use better default and add another timeout parameter
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
1 parent 5cf65c0 commit e03ca00

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docling_jobkit/orchestrators/rq/orchestrator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class RQOrchestratorConfig(BaseModel):
3636
sub_channel: str = "docling:updates"
3737
scratch_dir: Optional[Path] = None
3838
redis_max_connections: int = 50
39-
redis_socket_timeout: float = 5.0
39+
redis_socket_timeout: Optional[float] = None
40+
redis_socket_connect_timeout: Optional[float] = None
4041

4142

4243
class _TaskUpdate(BaseModel):
@@ -54,7 +55,7 @@ def make_rq_queue(config: RQOrchestratorConfig) -> tuple[redis.Redis, Queue]:
5455
config.redis_url,
5556
max_connections=config.redis_max_connections,
5657
socket_timeout=config.redis_socket_timeout,
57-
socket_connect_timeout=config.redis_socket_timeout,
58+
socket_connect_timeout=config.redis_socket_connect_timeout,
5859
)
5960
conn = redis.Redis(connection_pool=pool)
6061
rq_queue = Queue(
@@ -65,7 +66,8 @@ def make_rq_queue(config: RQOrchestratorConfig) -> tuple[redis.Redis, Queue]:
6566
)
6667
_log.info(
6768
f"RQ Redis connection pool initialized with max_connections="
68-
f"{config.redis_max_connections}, socket_timeout={config.redis_socket_timeout}s"
69+
f"{config.redis_max_connections}, socket_timeout={config.redis_socket_timeout}, "
70+
f"socket_connect_timeout={config.redis_socket_connect_timeout}"
6971
)
7072
return conn, rq_queue
7173

@@ -82,7 +84,7 @@ def __init__(
8284
self.config.redis_url,
8385
max_connections=config.redis_max_connections,
8486
socket_timeout=config.redis_socket_timeout,
85-
socket_connect_timeout=config.redis_socket_timeout,
87+
socket_connect_timeout=config.redis_socket_connect_timeout,
8688
)
8789
self._async_redis_conn = async_redis.Redis(
8890
connection_pool=self._async_redis_pool

0 commit comments

Comments
 (0)