From 7d34781013e4440c3ea7cac6230d8fdf58fe157f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 4 Jan 2016 01:01:23 -0500 Subject: [PATCH] Avoid redundant loading of disabled modules. --- earwigbot/managers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/earwigbot/managers.py b/earwigbot/managers.py index 611645e..dbd0bf2 100644 --- a/earwigbot/managers.py +++ b/earwigbot/managers.py @@ -133,14 +133,14 @@ class _ResourceManager(object): if name.startswith("_") or name.startswith("."): continue modname = sub("\.pyc?$", "", name) # Remove extension + if modname in processed: + continue + processed.append(modname) if self._is_disabled(modname): log = "Skipping disabled module {0}".format(modname) self.logger.debug(log) - processed.append(modname) continue - if modname not in processed: - self._load_module(modname, dir) - processed.append(modname) + self._load_module(modname, dir) def _unload_resources(self): """Unload all resources, calling their unload hooks in the process."""