mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Fix mypy for platforms without epoll support. (#11771)
This commit is contained in:
parent
7ad7a47e5a
commit
c072c0b829
1
changelog.d/11771.misc
Normal file
1
changelog.d/11771.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Improve accuracy of `python_twisted_reactor_tick_time` prometheus metric.
|
@ -35,7 +35,7 @@ tick_time = Histogram(
|
|||||||
class EpollWrapper:
|
class EpollWrapper:
|
||||||
"""a wrapper for an epoll object which records the time between polls"""
|
"""a wrapper for an epoll object which records the time between polls"""
|
||||||
|
|
||||||
def __init__(self, poller: "select.epoll"):
|
def __init__(self, poller: "select.epoll"): # type: ignore[name-defined]
|
||||||
self.last_polled = time.time()
|
self.last_polled = time.time()
|
||||||
self._poller = poller
|
self._poller = poller
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ try:
|
|||||||
# if the reactor has a `_poller` attribute, which is an `epoll` object
|
# if the reactor has a `_poller` attribute, which is an `epoll` object
|
||||||
# (ie, it's an EPollReactor), we wrap the `epoll` with a thing that will
|
# (ie, it's an EPollReactor), we wrap the `epoll` with a thing that will
|
||||||
# measure the time between ticks
|
# measure the time between ticks
|
||||||
from select import epoll
|
from select import epoll # type: ignore[attr-defined]
|
||||||
|
|
||||||
poller = reactor._poller # type: ignore[attr-defined]
|
poller = reactor._poller # type: ignore[attr-defined]
|
||||||
except (AttributeError, ImportError):
|
except (AttributeError, ImportError):
|
||||||
|
Loading…
Reference in New Issue
Block a user