|
9 | 9 | import re |
10 | 10 | import sys |
11 | 11 | import types |
| 12 | +import warnings |
12 | 13 | from pathlib import Path |
13 | 14 | from typing import Any, Optional |
14 | 15 |
|
|
20 | 21 |
|
21 | 22 | from . import __version__, _autoreload, _hostenv, _static, _utils |
22 | 23 | from ._docstring import no_example |
| 24 | +from ._hostenv import is_workbench |
23 | 25 | from ._typing_extensions import NotRequired, TypedDict |
24 | 26 | from .bookmark._bookmark_state import shiny_bookmarks_folder_name |
25 | 27 | from .express import is_express_app |
@@ -399,6 +401,8 @@ def run_app( |
399 | 401 |
|
400 | 402 | maybe_setup_rsw_proxying(log_config) |
401 | 403 |
|
| 404 | + _set_workbench_kwargs(kwargs) |
| 405 | + |
402 | 406 | uvicorn.run( # pyright: ignore[reportUnknownMemberType] |
403 | 407 | app, |
404 | 408 | host=host, |
@@ -713,6 +717,18 @@ class ReloadArgs(TypedDict): |
713 | 717 | reload_dirs: NotRequired[list[str]] |
714 | 718 |
|
715 | 719 |
|
| 720 | +def _set_workbench_kwargs(kwargs: dict[str, Any]) -> None: |
| 721 | + if is_workbench(): |
| 722 | + if kwargs.get("ws_per_message_deflate"): |
| 723 | + # Workaround for nginx/uvicorn issue within Workbench |
| 724 | + # https://github.com/rstudio/rstudio-pro/issues/7368#issuecomment-2918016088 |
| 725 | + warnings.warn( |
| 726 | + "Overwriting kwarg `ws_per_message_deflate=True` to `False` to avoid breaking issue in Workbench", |
| 727 | + stacklevel=2, |
| 728 | + ) |
| 729 | + kwargs["ws_per_message_deflate"] = False |
| 730 | + |
| 731 | + |
716 | 732 | # Check that the version of rsconnect supports Shiny Express; can be removed in the |
717 | 733 | # future once this version of rsconnect is widely used. The dependency on "packaging" |
718 | 734 | # can also be removed then, because it is only used here. (Added 2024-03) |
|
0 commit comments