FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: reduce overhead to process incoming questions (#1244) · python-zeroconf/python-zeroconf@18b65d1 · GitHub

Repository navigation

Commit 18b65d1

Browse files
authored
feat: reduce overhead to process incoming questions (#1244)
1 parent a3e98cb commit 18b65d1

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

‎build_ext.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def build(setup_kwargs: Any) -> None:
3131
"src/zeroconf/_protocol/outgoing.py",
3232
"src/zeroconf/_handlers/record_manager.py",
3333
"src/zeroconf/_services/registry.py",
34+
"src/zeroconf/_utils/time.py",
3435
],
3536
compiler_directives={"language_level": "3"}, # Python 3
3637
),

‎src/zeroconf/_listener.pxd‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

22
import cython
33

4+
from ._protocol.incoming cimport DNSIncoming
5+
from ._utils.time cimport current_time_millis, millis_to_seconds
6+
47

5-
cdef object millis_to_seconds
68
cdef object log
79
cdef object logging_DEBUG
810

9-
from ._protocol.incoming cimport DNSIncoming
10-
1111

1212
cdef class AsyncListener:
1313

‎src/zeroconf/_utils/time.pxd‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
cpdef current_time_millis()
3+
4+
cpdef millis_to_seconds(object millis)

‎src/zeroconf/_utils/time.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
import time
2525

26+
_float = float
27+
2628

2729
def current_time_millis() -> float:
2830
"""Current time in milliseconds.
@@ -33,6 +35,6 @@ def current_time_millis() -> float:
3335
return time.monotonic() * 1000
3436

3537

36-
def millis_to_seconds(millis: float) -> float:
38+
def millis_to_seconds(millis: _float) -> float:
3739
"""Convert milliseconds to seconds."""
3840
return millis / 1000.0

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL