commit 702d8d329b8c305b0dc7207e550b6d89b98aab25 Author: Damian Johnson atagar@torproject.org Date: Sat Jul 23 11:41:58 2016 -0700
Occasional stacktraces when starting up
When starting up we occasionally flashed a stacktrace such as...
File "/home/atagar/Desktop/nyx/nyx/panel/graph.py", line 596, in _update_accounting if not nyx_controller.is_paused(): AttributeError 'NoneType' object has no attribute 'is_paused'
The issue is that our Controller's constructor creates panels which in turn have threads that use the still-incomplete controller. As such breaking the constructor into two parts. The first creates a blank instance and the second adds the panels.
Don't really like this but fixes the issue. I'll revisit this when it's the controller's turn to be rewitten. --- nyx/controller.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/nyx/controller.py b/nyx/controller.py index d02dbeb..8040e7e 100644 --- a/nyx/controller.py +++ b/nyx/controller.py @@ -98,9 +98,18 @@ class Controller(object): top to bottom on the page. """
- self._header_panel = nyx.panel.header.HeaderPanel() + self._page_panels = [] + self._header_panel = None + self.quit_signal = False + self._page = 0 + self._paused = False + self._pause_time = -1 + self._force_redraw = False + self._last_drawn = 0
- self._page_panels, first_page_panels = [], [] + def init(self): + self._header_panel = nyx.panel.header.HeaderPanel() + first_page_panels = []
if CONFIG['features.panels.show.graph']: first_page_panels.append(nyx.panel.graph.GraphPanel()) @@ -330,6 +339,7 @@ def start_nyx(): global NYX_CONTROLLER
NYX_CONTROLLER = Controller() + NYX_CONTROLLER.init() control = get_controller()
if not CONFIG['features.acsSupport']: