Functions
_draining_health_method
2
bytes | None
▼
Return GET/HEAD when *request_head* targets the configured health path.
_draining_health_method
2
bytes | None
▼
def _draining_health_method(request_head: bytes, health_check_path: str | None) -> bytes | None
Parameters
| Name | Type | Description |
|---|---|---|
request_head |
bytes |
|
health_check_path |
str | None |
Returns
bytes | None
_draining_health_response
3
bytes
▼
Serialize the configured readiness response for the drain boundary.
_draining_health_response
3
bytes
▼
def _draining_health_response(method: bytes, *, worker_id: int, active_connections: int) -> bytes
Parameters
| Name | Type | Description |
|---|---|---|
method |
bytes |
|
worker_id |
int |
|
active_connections |
int |
Returns
bytes
_read_request_head_sync
3
bytes
▼
Read one bounded HTTP/1 header block from a draining socket.
_read_request_head_sync
3
bytes
▼
def _read_request_head_sync(conn: socket.socket, config: ServerConfig, *, timeout: float | None) -> bytes
Parameters
| Name | Type | Description |
|---|---|---|
conn |
socket.socket |
|
config |
ServerConfig |
|
timeout |
float | None |
Returns
bytes
_read_request_head_async
3
bytes
▼
Read one bounded HTTP/1 header block from a draining stream.
async
_read_request_head_async
3
bytes
▼
async def _read_request_head_async(reader: asyncio.StreamReader, config: ServerConfig, *, timeout: float | None) -> bytes
Parameters
| Name | Type | Description |
|---|---|---|
reader |
asyncio.StreamReader |
|
config |
ServerConfig |
|
timeout |
float | None |
Returns
bytes
write_drain_503_sync
1
None
▼
Send the drain 503 on a blocking socket; the caller still owns the close.
Tole…
write_drain_503_sync
1
None
▼
def write_drain_503_sync(conn: socket.socket) -> None
Send the drain 503 on a blocking socket; the caller still owns the close.
Tolerates a client that has already gone away — a dropped connection during shutdown is expected, not exceptional.
Parameters
| Name | Type | Description |
|---|---|---|
conn |
socket.socket |
write_drain_response_sync
5
None
▼
Inspect one bounded request and write the matching drain response.
write_drain_response_sync
5
None
▼
def write_drain_response_sync(conn: socket.socket, config: ServerConfig, *, worker_id: int, active_connections: int, timeout: float | None = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
conn |
socket.socket |
|
config |
ServerConfig |
|
worker_id |
int |
|
active_connections |
int |
|
timeout |
float | None |
Default:None
|
write_drain_503_async
2
None
▼
Send the drain 503 on an asyncio writer and close it.
Tolerates a client that …
async
write_drain_503_async
2
None
▼
async def write_drain_503_async(writer: asyncio.StreamWriter, *, timeout: float = 30.0) -> None
Send the drain 503 on an asyncio writer and close it.
Tolerates a client that has already gone away — a dropped connection during shutdown is expected, not exceptional.
Parameters
| Name | Type | Description |
|---|---|---|
writer |
asyncio.StreamWriter |
|
timeout |
float |
Default:30.0
|
write_drain_response_async
6
None
▼
Inspect one bounded request, write its drain response, and close.
async
write_drain_response_async
6
None
▼
async def write_drain_response_async(reader: asyncio.StreamReader, writer: asyncio.StreamWriter, config: ServerConfig, *, worker_id: int, active_connections: int, timeout: float | None = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
reader |
asyncio.StreamReader |
|
writer |
asyncio.StreamWriter |
|
config |
ServerConfig |
|
worker_id |
int |
|
active_connections |
int |
|
timeout |
float | None |
Default:None
|