Skip to content

Commit c010378

Browse files
committed
perf: optimize async HTTP/2 transport performance
1 parent 6a6e070 commit c010378

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1672
-1190
lines changed

.license-ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ NOTICE
1313
.pre-commit-config.yaml
1414
.python-version
1515
uv.lock
16+
py.typed
1617

1718

1819
# directories

docs/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ For more details, refer to https://hatch.pypa.io/latest/publish/
220220

221221
> Reference: [Publishing package distribution releases using GitHub Actions CI/CD workflows](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/)
222222
223-
##### Prerequisites: Configuring Trusted Publishing
223+
**Prerequisites: Configuring Trusted Publishing**
224224

225225
Follow the **[Configuring Trusted Publishing](https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#configuring-trusted-publishing)** section of the official guide to ensure that only manually approved workflow runs are permitted to publish to PyPI.
226226

227227
**NOTE**: For security reasons, you must require [manual approval](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules) on each run for the `pypi` environment.
228228

229-
##### Trigger Conditions
229+
**Trigger Conditions**
230230

231-
The `publish` workflow is triggered whenever a new Release is created in the GitHub repository. It will build the source code corresponding to that Release, upload the resulting artifacts, and then publish the package to PyPI.
231+
The `publish` workflow is triggered whenever a new Release is published in the GitHub repository. It will build the source code corresponding to that Release, upload the resulting artifacts, and then publish the package to PyPI.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ dependencies = [
5959
"anyio>=4.9.0",
6060
"h2>=4.1.0",
6161
"psutil>=6.0.0",
62+
"sniffio>=1.3.1",
6263
"typing-extensions>=4.13.2; python_version < '3.10'",
6364
]
6465

src/dubbo/bootstrap.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/dubbo/common/_url.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,28 @@ def get_method_param_bool(self, method: str, key: str, default: bool = False) ->
334334
value = self.get_method_param(method, key)
335335
return value.lower() in _BOOL_TRUE if value else default
336336

337+
def get_group(self, default: str = "") -> str:
338+
"""Get the group parameter value.
339+
340+
Args:
341+
default: Default value if 'group' parameter not found
342+
343+
Returns:
344+
Group value if present, else default
345+
"""
346+
return self.get_param(constants.GROUP_KEY, default)
347+
348+
def get_interface(self, default: str = "") -> str:
349+
"""Get the service parameter value.
350+
351+
Args:
352+
default: Default value if 'service' parameter not found
353+
354+
Returns:
355+
Service value if present, else default
356+
"""
357+
return self.get_param(constants.INTERFACE_KEY, default)
358+
337359
# ---------------------- Attribute Methods ----------------------
338360

339361
def add_attribute(self, key: str, value: Any) -> None:

src/dubbo/common/constants/_key.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@
2121
PORT_KEY = "port"
2222
PATH_KEY = "path"
2323

24-
TIMEOUT_KEY = "timeout"
24+
INTERFACE_KEY = "interface"
2525
METHODS_KEY = "methods"
2626
METHOD_KEY = "method"
27+
GROUP_KEY = "group"
28+
VERSION_KEY = "version"
29+
CATEGORY_KEY = "category"
30+
31+
DYNAMIC_KEY = "dynamic"
32+
TIMEOUT_KEY = "timeout"
2733
WEIGHT_KEY = "weight"
2834
TIMESTAMP_KEY = "timestamp"
2935
WARMUP_KEY = "warmup"
36+
37+
TOKEN_KEY = "token"

src/dubbo/common/constants/_value.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
PRODUCTION_ENVIRONMENT,
2929
}
3030

31+
DEFAULT_TRI_PORT = 50051
3132

32-
DEFAULT_TIMEOUT_VALUE = 10.0 # units: seconds
33-
33+
DEFAULT_CATEGORY = "providers"
3434

35+
DEFAULT_TIMEOUT_VALUE = 10.0 # units: seconds
3536
DEFAULT_WEIGHT_VALUE = 100
3637
DEFAULT_WARMUP_VALUE = 0

src/dubbo/common/utils/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def to_bytes(data: StrOrBytes, encoding=constants.UTF_8) -> bytes:
3636
result = to_bytes("hello")
3737
result = to_bytes(bytearray(b"data"))
3838
"""
39-
if isinstance(data, str):
40-
return data.encode(encoding)
4139
if isinstance(data, bytes):
4240
return data
4341
if isinstance(data, bytearray):
4442
return bytes(data)
4543
if isinstance(data, memoryview):
4644
return data.tobytes()
45+
if isinstance(data, str):
46+
return data.encode(encoding)
4747

4848
raise TypeError(f"Expected str, bytes, bytearray, or memoryview, got {type(data).__name__}")
4949

src/dubbo/config/__init__.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/dubbo/config/_application.py

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)