Skip to content

Commit 5a1afe0

Browse files
fix(build): prevent Redis connections during Docker collectstatic build step (#52011)
Co-authored-by: mendral-app[bot] <233154221+mendral-app[bot]@users.noreply.github.com>
1 parent eeee7bb commit 5a1afe0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

products/notebooks/backend/kernel_runtime.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,8 +1561,15 @@ def dataframe_page(
15611561
return payload
15621562

15631563

1564-
notebook_kernel_runtime_service = KernelRuntimeService()
1564+
_notebook_kernel_runtime_service: KernelRuntimeService | None = None
1565+
1566+
1567+
def _get_service() -> KernelRuntimeService:
1568+
global _notebook_kernel_runtime_service
1569+
if _notebook_kernel_runtime_service is None:
1570+
_notebook_kernel_runtime_service = KernelRuntimeService()
1571+
return _notebook_kernel_runtime_service
15651572

15661573

15671574
def get_kernel_runtime(notebook: Notebook, user: User | None) -> KernelRuntimeSession:
1568-
return notebook_kernel_runtime_service.get_kernel_runtime(notebook, user)
1575+
return _get_service().get_kernel_runtime(notebook, user)

0 commit comments

Comments
 (0)