[nyx/master] Let nyx shut down faster

commit b29878e70c46a226c76d45c9adad746d54751213 Author: Damian Johnson <atagar@torproject.org> Date: Wed Nov 1 11:34:24 2017 -0700 Let nyx shut down faster Especially when first starting up nyx takes a couple seconds to shut down on my relay. This is because the update method of our connection panel can take a while if there's many relays. Aborting in the middle of its longest part if the thread's terminated. This drops our shutdown time in practice to a few milliseconds. --- nyx/panel/connection.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py index 15a2638..f4d7df6 100644 --- a/nyx/panel/connection.py +++ b/nyx/panel/connection.py @@ -531,6 +531,12 @@ class ConnectionPanel(nyx.panel.DaemonPanel): for entry in new_entries: line = entry.get_lines()[0] + # This loop is the lengthiest part of our update. If our thread's stopped + # we should abort further work. + + if self._halt: + return + if entry.is_private() and line.connection not in self._counted_connections: if entry.get_type() == Category.INBOUND and line.locale: self._client_locale_usage[line.locale] = self._client_locale_usage.get(line.locale, 0) + 1
participants (1)
-
atagar@torproject.org