Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix mypy for platforms without epoll support. #11771

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11771.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve accuracy of `python_twisted_reactor_tick_time` prometheus metric.
4 changes: 2 additions & 2 deletions synapse/metrics/_reactor_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
class EpollWrapper:
"""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._poller = poller

Expand Down Expand Up @@ -71,7 +71,7 @@ def collect(self) -> Iterable[Metric]:
# 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
# measure the time between ticks
from select import epoll
from select import epoll # type: ignore[attr-defined]

poller = reactor._poller # type: ignore[attr-defined]
except (AttributeError, ImportError):
Expand Down