Skip to content

Commit

Permalink
add compress body size cli args
Browse files Browse the repository at this point in the history
  • Loading branch information
KarryCharon committed Feb 3, 2025
1 parent 10184d8 commit 49b48a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions comfy/cli_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def is_valid_directory(path: Optional[str]) -> Optional[str]:

parser.add_argument("--disable-compres-response-body", action="store_true", help="Disable compressing response body.")

parser.add_argument("--compres-response-body-size", type=int, default=10, help="Compressing response body size limit(MB).")

if comfy.options.args_parsing:
args = parser.parse_args()
else:
Expand Down
4 changes: 4 additions & 0 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ async def compress_body(request: web.Request, handler):
return response
if response.body and "gzip" in accept_encoding:
response.enable_compression()
compress_size = args.compres_response_body_size
compress_size *= 1024 * 1024 # To MB
compress_size = max(1024, compress_size)
response._zlib_executor_size = compress_size
return response


Expand Down

0 comments on commit 49b48a6

Please sign in to comment.