Skip to content

Commit e72a400

Browse files
committed
Register SERVER_H2_MAX_CONCURRENT_STREAMS with default of 100
Moves the setting from a hidden getattr fallback to a proper registered setting in global_settings.py. Default of 100 matches the HTTP/2 spec recommendation and the h2 library's own internal default.
1 parent b0bfb96 commit e72a400

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

plain/plain/runtime/global_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
SERVER_GRACEFUL_TIMEOUT: int = 30
193193
SERVER_SENDFILE: bool = True
194194
SERVER_CONNECTIONS: int = 1000
195+
SERVER_H2_MAX_CONCURRENT_STREAMS: int = 100
195196

196197
# MARK: Preflight Checks
197198

plain/plain/server/http/h2.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,11 @@ async def async_handle_h2_connection(
318318

319319
from plain.runtime import settings
320320

321-
# Configure max concurrent streams if set
322-
max_streams = getattr(settings, "SERVER_H2_MAX_CONCURRENT_STREAMS", None)
323-
if max_streams:
324-
conn.update_settings(
325-
{
326-
h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS: max_streams,
327-
}
328-
)
321+
conn.update_settings(
322+
{
323+
h2.settings.SettingCodes.MAX_CONCURRENT_STREAMS: settings.SERVER_H2_MAX_CONCURRENT_STREAMS,
324+
}
325+
)
329326

330327
scheme = "https" if is_ssl else "http"
331328
max_body = settings.DATA_UPLOAD_MAX_MEMORY_SIZE or _H2_BODY_FALLBACK

0 commit comments

Comments
 (0)